aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorAlexander Kiryukhin <a.kiryukhin@corp.mail.ru>2019-04-04 11:54:24 +0300
committerAlexander Kiryukhin <a.kiryukhin@corp.mail.ru>2019-04-04 11:54:24 +0300
commit08cbc9b6c05427fd3864bab55a4b40146c54639d (patch)
treec44ab6f2b976a974c20894b29ee0401b5c073676 /example
parentc86dd5f3d70d310a26da73ee4ef2897121c18909 (diff)
Changed:
- Refactored errors chan Fixed: - Small fixes
Diffstat (limited to 'example')
-rw-r--r--example/policies.go9
1 files changed, 4 insertions, 5 deletions
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)
}
}