Start a single task executing the given function with the given schedule. This is a convenience around Group and it returns two functions that can be used to control the task. The first is a "stop" function trying to terminate the task gracefully within the given timeout and the second is a "reset"
(ctx context.Context, f Func, schedule Schedule)
| 13 | // function to reset the task's state. See Group.Stop() and Group.Reset() for |
| 14 | // more details. |
| 15 | func Start(ctx context.Context, f Func, schedule Schedule) (func(time.Duration) error, func()) { |
| 16 | group := Group{} |
| 17 | task := group.Add(f, schedule) |
| 18 | group.Start(ctx) |
| 19 | |
| 20 | stop := group.Stop |
| 21 | reset := task.Reset |
| 22 | |
| 23 | return stop, reset |
| 24 | } |
searching dependent graphs…