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

Method GetCountWithWorkingBlock

backend/helpers/pluginhelper/api/queue.go:155–170  ·  view source on GitHub ↗

GetCount get the node count in query and only return zero when working zero

()

Source from the content-addressed store, hash-verified

153
154// GetCount get the node count in query and only return zero when working zero
155func (q *Queue) GetCountWithWorkingBlock() int64 {
156 q.mux.Lock()
157 defer q.mux.Unlock()
158
159 for {
160 if q.count == 0 && q.working > 0 {
161 q.mux.Unlock()
162
163 time.Sleep(time.Second)
164
165 q.mux.Lock()
166 } else {
167 return q.count
168 }
169 }
170}
171
172// NewQueue create and init a new Queue
173func NewQueue() *Queue {

Callers 1

TestQueueFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestQueueFunction · 0.76