-
Notifications
You must be signed in to change notification settings - Fork 2
/
nop.go
50 lines (41 loc) · 837 Bytes
/
nop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package schedule
import (
"context"
"time"
)
// nopScheduler is a scheduler which does not do anything.
type nopScheduler struct{}
// NopScheduler returns a scheduler which discards all jobs
func NopScheduler() Scheduler {
return &nopScheduler{}
}
func (s *nopScheduler) Start(ctx context.Context) error {
return nil
}
func (s *nopScheduler) HandleFunc(
target string, fn Fn,
) (deregister func(), err error) {
return func() {}, nil
}
func (s *nopScheduler) At(
ctx context.Context,
t time.Time,
target string,
data []byte,
o ...JobOption,
) (string, error) {
return "", nil
}
func (s *nopScheduler) In(
ctx context.Context,
d time.Duration,
target string,
data []byte,
o ...JobOption,
) (string, error) {
return "", nil
}
func (s *nopScheduler) Drain() {}
func (s *nopScheduler) Close() error {
return nil
}