From 01eeeaf5e136928abe75f95d58f3f9cce11c6fe6 Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Sat, 29 Jun 2019 01:19:21 +0300 Subject: Release. Auto listen OS signal (with mixin) Policies: ...Fail -> ...Error --- example/policies.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'example') diff --git a/example/policies.go b/example/policies.go index 3e14f5a..6addea7 100644 --- a/example/policies.go +++ b/example/policies.go @@ -21,31 +21,31 @@ func main() { <-time.After(1 * time.Second) log.Println("Do something 1 second without errors and restart") return nil - }, rutina.RestartIfDone, rutina.ShutdownIfFail) + }, rutina.RestartIfDone, rutina.ShutdownIfError) r.Go(func(ctx context.Context) error { <-time.After(2 * time.Second) log.Println("Do something 2 seconds without errors and do nothing") return nil - }, rutina.DoNothingIfDone, rutina.ShutdownIfFail) + }, rutina.DoNothingIfDone, rutina.ShutdownIfError) r.Go(func(ctx context.Context) error { <-time.After(3 * time.Second) log.Println("Do something 3 seconds with error and restart") return errors.New("Error #1!") - }, rutina.RestartIfFail) + }, rutina.RestartIfError) r.Go(func(ctx context.Context) error { <-time.After(4 * time.Second) log.Println("Do something 4 seconds with error and do nothing") return errors.New("Error #2!") - }, rutina.DoNothingIfFail) + }, rutina.DoNothingIfError) r.Go(func(ctx context.Context) error { <-time.After(10 * time.Second) log.Println("Do something 10 seconds with error and close context") return errors.New("Successfully shutdown at proper place") - }, rutina.ShutdownIfFail) + }, rutina.ShutdownIfError) r.Go(func(ctx context.Context) error { for { -- cgit v1.2.3