From 23c520ad3a1d5a1b56883f9e456d2f755b325b18 Mon Sep 17 00:00:00 2001 From: Nguyen Thanh Quang <57827456+AlphaNecron@users.noreply.github.com> Date: Mon, 21 Aug 2023 22:11:00 +0700 Subject: [PATCH] add slow operation warning --- queue.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/queue.go b/queue.go index e53686d..8999882 100644 --- a/queue.go +++ b/queue.go @@ -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 { @@ -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) }