Skip to content

Commit

Permalink
use uint64 for priority variable
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Peña <[email protected]>
  • Loading branch information
piggito committed Sep 9, 2024
1 parent f89dfed commit fb7c41d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/v3/experimental/recipes/priority_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewPriorityQueue(client *v3.Client, key string) *PriorityQueue {
}

// Enqueue puts a value into a queue with a given priority.
func (q *PriorityQueue) Enqueue(val string, pr uint16) error {
func (q *PriorityQueue) Enqueue(val string, pr uint64) error {
prefix := fmt.Sprintf("%s%05d", q.key, pr)
_, err := newSequentialKV(q.client, prefix, val)
return err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestPrQueueOneReaderOneWriter(t *testing.T) {
q := recipe.NewPriorityQueue(etcdc, "testprq")
for i := 0; i < 5; i++ {
// [0, 2] priority for priority collision to test seq keys
pr := uint16(rand.Intn(3))
pr := uint64(rand.Intn(3))
if err := q.Enqueue(fmt.Sprintf("%d", pr), pr); err != nil {
t.Fatalf("error enqueuing (%v)", err)
}
Expand Down Expand Up @@ -232,7 +232,7 @@ type flatPriorityQueue struct{ *recipe.PriorityQueue }

func (q *flatPriorityQueue) Enqueue(val string) error {
// randomized to stress dequeuing logic; order isn't important
return q.PriorityQueue.Enqueue(val, uint16(rand.Intn(2)))
return q.PriorityQueue.Enqueue(val, uint64(rand.Intn(2)))
}
func (q *flatPriorityQueue) Dequeue() (string, error) {
return q.PriorityQueue.Dequeue()
Expand Down

0 comments on commit fb7c41d

Please sign in to comment.