MCPcopy
hub / github.com/garethgeorge/backrest / Enqueue

Method Enqueue

internal/queue/timequeue.go:26–36  ·  view source on GitHub ↗
(at time.Time, v T)

Source from the content-addressed store, hash-verified

24}
25
26func (t *TimeQueue[T]) Enqueue(at time.Time, v T) {
27 t.mu.Lock()
28 heap.Push(&t.heap, timeQueueEntry[T]{at, v})
29 t.mu.Unlock()
30 if n := t.notify.Load(); n != nil {
31 select {
32 case *n <- struct{}{}:
33 default:
34 }
35 }
36}
37
38func (t *TimeQueue[T]) Len() int {
39 t.mu.Lock()

Callers 12

TestTPQPriorityFunction · 0.45
TestTPQStressFunction · 0.45
TestTPQRemoveFunction · 0.45
TestTPQResetFunction · 0.45
TestTPQGetAllFunction · 0.45
TestTimeQueueFunction · 0.45
TestFuzzTimeQueueFunction · 0.45
CancelOperationMethod · 0.45
retryTaskMethod · 0.45
ScheduleTaskMethod · 0.45

Calls 3

LockMethod · 0.80
PushMethod · 0.80
UnlockMethod · 0.45

Tested by 9

TestTPQPriorityFunction · 0.36
TestTPQStressFunction · 0.36
TestTPQRemoveFunction · 0.36
TestTPQResetFunction · 0.36
TestTPQGetAllFunction · 0.36
TestTimeQueueFunction · 0.36
TestFuzzTimeQueueFunction · 0.36