From 0a0f9e288a790a05e8b9968bb5beb85da01aa4cc Mon Sep 17 00:00:00 2001 From: interface Date: Fri, 5 Jul 2024 11:30:15 +0800 Subject: [PATCH] fix: remove unused code in queue.go/queue --- pkg/event/queue.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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)) }