Skip to content

Commit fb7c41d

Browse files
committed
use uint64 for priority variable
Signed-off-by: Juan Peña <[email protected]>
1 parent f89dfed commit fb7c41d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

client/v3/experimental/recipes/priority_queue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func NewPriorityQueue(client *v3.Client, key string) *PriorityQueue {
3535
}
3636

3737
// Enqueue puts a value into a queue with a given priority.
38-
func (q *PriorityQueue) Enqueue(val string, pr uint16) error {
38+
func (q *PriorityQueue) Enqueue(val string, pr uint64) error {
3939
prefix := fmt.Sprintf("%s%05d", q.key, pr)
4040
_, err := newSequentialKV(q.client, prefix, val)
4141
return err

tests/integration/clientv3/experimental/recipes/v3_queue_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestPrQueueOneReaderOneWriter(t *testing.T) {
102102
q := recipe.NewPriorityQueue(etcdc, "testprq")
103103
for i := 0; i < 5; i++ {
104104
// [0, 2] priority for priority collision to test seq keys
105-
pr := uint16(rand.Intn(3))
105+
pr := uint64(rand.Intn(3))
106106
if err := q.Enqueue(fmt.Sprintf("%d", pr), pr); err != nil {
107107
t.Fatalf("error enqueuing (%v)", err)
108108
}
@@ -232,7 +232,7 @@ type flatPriorityQueue struct{ *recipe.PriorityQueue }
232232

233233
func (q *flatPriorityQueue) Enqueue(val string) error {
234234
// randomized to stress dequeuing logic; order isn't important
235-
return q.PriorityQueue.Enqueue(val, uint16(rand.Intn(2)))
235+
return q.PriorityQueue.Enqueue(val, uint64(rand.Intn(2)))
236236
}
237237
func (q *flatPriorityQueue) Dequeue() (string, error) {
238238
return q.PriorityQueue.Dequeue()

0 commit comments

Comments
 (0)