Skip to content

Commit

Permalink
More documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
destel committed Mar 20, 2024
1 parent b87cb78 commit caa8698
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions examples/redis-read/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion examples/weather/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit caa8698

Please sign in to comment.