Skip to content

Commit

Permalink
add slow operation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaNecron authored Aug 21, 2023
1 parent 4fcdec9 commit 23c520a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (queue *redisQueue) PublishBytes(payload ...[]byte) error {
return queue.Publish(stringifiedBytes...)
}

// Remove elements with specific value from the queue
// Remove elements with specific value from the queue (WARN: this operation is pretty slow with O(N+M) complexity where N is length of the queue and M is number of removed elements)
func (queue *redisQueue) Remove(payload string, count int64, removeFromRejected bool) error {
_, err := queue.redisClient.LRem(queue.readyKey, count, payload)
if removeFromRejected {
Expand All @@ -130,7 +130,7 @@ func (queue *redisQueue) Remove(payload string, count int64, removeFromRejected
return err
}

// RemoveBytes casts bytes to string and calls Remove
// RemoveBytes casts bytes to string and calls Remove (WARN: this operation is pretty slow with O(N+M) complexity where N is length of the queue and M is number of removed elements)
func (queue *redisQueue) RemoveBytes(payload []byte, count int64, removeFromRejected bool) error {
return queue.Remove(string(payload), count, removeFromRejected)
}
Expand Down

0 comments on commit 23c520a

Please sign in to comment.