MCPcopy Index your code
hub / github.com/apache/devlake / PullWithWorkingBlock

Method PullWithWorkingBlock

backend/helpers/pluginhelper/api/queue.go:70–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70func (q *Queue) PullWithWorkingBlock() QueueNode {
71 q.mux.Lock()
72 defer q.mux.Unlock()
73
74 for {
75 node := q.PullWithOutLock()
76 if node != nil {
77 q.working++
78
79 return node
80 } else if q.working > 0 {
81 q.mux.Unlock()
82
83 time.Sleep(time.Second)
84
85 q.mux.Lock()
86 } else {
87 return nil
88 }
89 }
90}
91
92// PushWithoutLock is no lock mode of Push
93func (q *Queue) PushWithoutLock(node QueueNode) {

Callers 1

TestQueueFunction · 0.95

Calls 1

PullWithOutLockMethod · 0.95

Tested by 1

TestQueueFunction · 0.76