Skip to content

Commit 05f8d5f

Browse files
committed
Improved upon Update fix
1 parent 303be53 commit 05f8d5f

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

pqueue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func (pq *PriorityQueue) Update(item *PriorityItem, newValue []byte) error {
233233
return ErrOutOfBounds
234234
}
235235

236+
item.Key = pq.generateKey(item.Priority, item.ID)
236237
item.Value = newValue
237238
return pq.db.Put(item.Key, item.Value, nil)
238239
}

queue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ func (q *Queue) Update(item *Item, newValue []byte) error {
158158
return ErrOutOfBounds
159159
}
160160

161+
item.Key = idToKey(item.ID)
161162
item.Value = newValue
162163
return q.db.Put(item.Key, item.Value, nil)
163164
}

stack.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ func (s *Stack) Update(item *Item, newValue []byte) error {
158158
return ErrOutOfBounds
159159
}
160160

161+
item.Key = idToKey(item.ID)
161162
item.Value = newValue
162163
return s.db.Put(item.Key, item.Value, nil)
163164
}

0 commit comments

Comments
 (0)