MCPcopy Create free account
hub / github.com/cortexproject/cortex / Close

Method Close

pkg/util/priority_queue.go:64–73  ·  view source on GitHub ↗

Close signals that the queue should be closed when it is empty. A closed queue will not accept new items.

()

Source from the content-addressed store, hash-verified

62// Close signals that the queue should be closed when it is empty.
63// A closed queue will not accept new items.
64func (pq *PriorityQueue) Close() {
65 pq.lock.Lock()
66 defer pq.lock.Unlock()
67 if len(pq.queue) > 0 {
68 pq.closing = true
69 } else {
70 pq.closed = true
71 }
72 pq.cond.Broadcast()
73}
74
75// DiscardAndClose closes the queue and removes all the items from it.
76func (pq *PriorityQueue) DiscardAndClose() {

Callers 5

TestPriorityQueueBasicFunction · 0.95
TestPriorityQueueWaitFunction · 0.95
TestPriorityQueueCloseFunction · 0.95

Calls 1

BroadcastMethod · 0.45

Tested by 5

TestPriorityQueueBasicFunction · 0.76
TestPriorityQueueWaitFunction · 0.76
TestPriorityQueueCloseFunction · 0.76