this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

explicit return

authored by

Brian Olson and committed by
Brian Olson
f664d91e 49556e41

+8 -11
+8 -11
bgs/compactor.go
··· 85 85 } 86 86 87 87 // Pop pops the first item off the front of the queue 88 - func (q *uniQueue) Pop() (item queueItem, ok bool) { 88 + func (q *uniQueue) Pop() (queueItem, bool) { 89 89 q.lk.Lock() 90 90 defer q.lk.Unlock() 91 91 92 92 if len(q.q) == 0 { 93 - ok = false 94 - return 93 + return queueItem{}, false 95 94 } 96 95 97 - item = q.q[0] 96 + item := q.q[0] 98 97 q.q = q.q[1:] 99 98 delete(q.members, item.uid) 100 99 101 100 compactionQueueDepth.Dec() 102 - ok = true 103 - return 101 + return item, true 104 102 } 105 103 106 104 // PopRandom pops a random item off the of the queue 107 105 // Note: this disrupts the sorted order of the queue and in-order is no longer quite in-order. The randomly popped element is replaced with the last element. 108 - func (q *uniQueue) PopRandom() (item queueItem, ok bool) { 106 + func (q *uniQueue) PopRandom() (queueItem, bool) { 109 107 q.lk.Lock() 110 108 defer q.lk.Unlock() 111 109 112 110 if len(q.q) == 0 { 113 - ok = false 114 - return 111 + return queueItem{}, false 115 112 } 116 113 114 + var item queueItem 117 115 if len(q.q) == 1 { 118 116 item = q.q[0] 119 117 q.q = nil ··· 127 125 delete(q.members, item.uid) 128 126 129 127 compactionQueueDepth.Dec() 130 - ok = true 131 - return 128 + return item, true 132 129 } 133 130 134 131 type CompactorState struct {