Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: fix: remove unused code in queue.go/queue #1423

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions pkg/event/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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))
}

Expand Down
Loading