MCPcopy Create free account
hub / github.com/CPChain/chain / get

Method get

protocols/cpc/syncer/queue.go:39–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39func (q *queue) get() (resultTask, error) {
40 timer := time.NewTimer(1 * time.Second)
41 select {
42 case task := <-q.queue:
43 atomic.AddInt32(&q.size, -1)
44 return task, nil
45 case <-timer.C:
46 return resultTask{}, ErrTimeout
47 }
48}
49
50func (q *queue) put(task resultTask) error {
51 if atomic.LoadInt32(&q.size) >= q.limit {

Callers 4

clearMethod · 0.95
TestQueuePutAndGetFunction · 0.45
TestQueueGetTimeoutFunction · 0.45
blocksHandlerMethod · 0.45

Calls

no outgoing calls

Tested by 2

TestQueuePutAndGetFunction · 0.36
TestQueueGetTimeoutFunction · 0.36