diff --git a/pkg/event/queue.go b/pkg/event/queue.go index be38937922..126199dee2 100644 --- a/pkg/event/queue.go +++ b/pkg/event/queue.go @@ -33,22 +33,17 @@ type Queue interface { // queue implements a fixed size Queue. type queue struct { - ring []*Event - tail uint32 - tailVersion map[uint32]*uint32 - mu sync.RWMutex + ring []*Event + tail uint32 + mu sync.RWMutex } // NewQueue creates a queue with the given capacity. func NewQueue(cap int) Queue { q := &queue{ - ring: make([]*Event, cap), - tailVersion: make(map[uint32]*uint32, cap), - } - for i := 0; i <= cap; i++ { - t := uint32(0) - q.tailVersion[uint32(i)] = &t + ring: make([]*Event, cap), } + return q } @@ -59,9 +54,6 @@ func (q *queue) Push(e *Event) { q.ring[q.tail] = e - newVersion := (*(q.tailVersion[q.tail])) + 1 - q.tailVersion[q.tail] = &newVersion - q.tail = (q.tail + 1) % uint32(len(q.ring)) }