From caa8698d4852757c52dd9693b19d49d2cdaff625 Mon Sep 17 00:00:00 2001 From: destel Date: Wed, 20 Mar 2024 17:07:46 +0200 Subject: [PATCH] More documentation fixes --- examples/redis-read/main.go | 6 ++---- examples/weather/main.go | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/redis-read/main.go b/examples/redis-read/main.go index 4468c44..8ed741e 100644 --- a/examples/redis-read/main.go +++ b/examples/redis-read/main.go @@ -32,12 +32,10 @@ func main() { } // printValues orchestrates a pipeline that fetches keys from URLs, retrieves their values from Redis, and prints them. -// The pipeline leverages concurrency for fetching and processing, utilizes batching for efficient Redis lookups, -// and employs context for graceful cancellation and timeout handling. Batching not only improves performance by -// reducing the number of Redis calls but also demonstrates the package's ability to group stream elements effectively. +// The pipeline leverages concurrency for fetching and processing and uses batching to reduce the number of Redis calls. func printValues(ctx context.Context, urls []string) error { ctx, cancel := context.WithCancel(ctx) - defer cancel() // In case of error or early exit, this ensures all http and redis operations are canceled + defer cancel() // In case of error, this ensures all http and redis operations are canceled // Convert URLs into a channel urlsChan := echans.FromSlice(urls) diff --git a/examples/weather/main.go b/examples/weather/main.go index 2e4dc27..ab5f999 100644 --- a/examples/weather/main.go +++ b/examples/weather/main.go @@ -26,9 +26,12 @@ func main() { } } +// printTemperatureMovements orchestrates a pipeline that fetches temperature measurements for a given city and +// prints the daily temperature movements. Measurements are fetched concurrently, but the movements are calculated +// in order, using a single goroutine. func printTemperatureMovements(ctx context.Context, city string, startDate, endDate time.Time) error { ctx, cancel := context.WithCancel(ctx) - defer cancel() // In case of error or early exit, this ensures all http are canceled + defer cancel() // In case of error, this ensures all pending operations are canceled // Make a channel that emits all the days between startDate and endDate days := make(chan echans.Try[time.Time])