NewOnceEvery creates a new OnceEvery struct
(d time.Duration)
| 15 | |
| 16 | // NewOnceEvery creates a new OnceEvery struct |
| 17 | func New(d time.Duration) *OnceEvery { |
| 18 | return &OnceEvery{ |
| 19 | Interval: d, |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // Do calls the function f if and only if Do hits the given periodic interval. |
| 24 | // In other words Do can be called multiple times during the interval but it |
no outgoing calls