MCPcopy
hub / github.com/kopia/kopia / Start

Function Start

internal/scheduler/scheduler.go:49–69  ·  view source on GitHub ↗

Start runs a new scheduler that will call getItems() to get the list of items to schedule.

(ctx context.Context, getItems GetItemsFunc, opts Options)

Source from the content-addressed store, hash-verified

47
48// Start runs a new scheduler that will call getItems() to get the list of items to schedule.
49func Start(ctx context.Context, getItems GetItemsFunc, opts Options) *Scheduler {
50 timeNow := opts.TimeNow
51
52 if timeNow == nil {
53 timeNow = clock.Now
54 }
55
56 s := &Scheduler{
57 TimeNow: timeNow,
58 refreshRequested: opts.RefreshChannel,
59 closed: make(chan struct{}),
60 getItems: getItems,
61 Debug: opts.Debug,
62 }
63
64 s.wg.Go(func() {
65 s.run(context.WithoutCancel(ctx))
66 })
67
68 return s
69}
70
71const sleepTimeWhenNoUpcomingSnapshots = 8 * time.Hour
72

Callers 4

TestSchedulerFunction · 0.92
TestSchedulerRefreshFunction · 0.92
SetRepositoryMethod · 0.92

Calls 1

runMethod · 0.95

Tested by 3

TestSchedulerFunction · 0.74
TestSchedulerRefreshFunction · 0.74