shutdown follower when leader stops

This commit is contained in:
chrislu committed 2024-04-01 22:32:30 -07:00
1 parent f07875e8e1
commit d935f70e3c
2 files changed
+120 -6

No files matched your search

@@ -117,6 +117,19 @@ func (q *BufferedQueue[T]) Dequeue() (T, bool) {
return job, true
}
func (q *BufferedQueue[T]) PeekHead() (T, bool) {
q.mutex.Lock()
defer q.mutex.Unlock()
if q.count <= 0 {
var a T
return a, false
}
job := q.head.items[q.head.headIndex]
return job, true
}
// Size returns the number of items in the queue
func (q *BufferedQueue[T]) Size() int {
q.mutex.Lock()