From 08cbc9b6c05427fd3864bab55a4b40146c54639d Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Thu, 4 Apr 2019 11:54:24 +0300 Subject: Changed: - Refactored errors chan Fixed: - Small fixes --- example/policies.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'example/policies.go') diff --git a/example/policies.go b/example/policies.go index 50a4e07..7a81359 100644 --- a/example/policies.go +++ b/example/policies.go @@ -5,18 +5,17 @@ package main import ( "context" "errors" - "github.com/neonxp/rutina" "log" "time" + + "github.com/neonxp/rutina" ) func main() { // New instance with builtin context r := rutina.New() - errsChan := make(chan error, 1) - - r = r.With(rutina.WithErrChan(errsChan)) + r = r.With(rutina.WithErrChan()) r.Go(func(ctx context.Context) error { <-time.After(1 * time.Second) @@ -54,7 +53,7 @@ func main() { case <-ctx.Done(): log.Println("Shutdown chan listener") return nil - case err := <-errsChan: + case err := <-r.Errors(): log.Printf("Error in chan: %v", err) } } -- cgit v1.2.3