MCPcopy
hub / github.com/tuna/tunasync / Pop

Method Pop

worker/schedule.go:63–82  ·  view source on GitHub ↗

pop out the first job if it's time to run it

()

Source from the content-addressed store, hash-verified

61
62// pop out the first job if it's time to run it
63func (q *scheduleQueue) Pop() *mirrorJob {
64 q.Lock()
65 defer q.Unlock()
66
67 first := q.list.SeekToFirst()
68 if first == nil {
69 return nil
70 }
71 defer first.Close()
72
73 t := first.Key().(time.Time)
74 if t.Before(time.Now()) {
75 job := first.Value().(*mirrorJob)
76 q.list.Delete(first.Key())
77 delete(q.jobs, job.Name())
78 logger.Debugf("Popped out job %s @%v", job.Name(), t)
79 return job
80 }
81 return nil
82}
83
84// remove job
85func (q *scheduleQueue) Remove(name string) bool {

Callers 2

TestScheduleFunction · 0.80
runScheduleMethod · 0.80

Calls 5

ValueMethod · 0.80
DebugfMethod · 0.80
CloseMethod · 0.65
DeleteMethod · 0.65
NameMethod · 0.65

Tested by 1

TestScheduleFunction · 0.64