Closed mafr closed 14 years ago
Thanks, certainly true and known. Original implementation was made to be simple as possible, single-writer. version 0.2.0 will cover multi-writer environments.
Sometimes you don't need to get lenght :
length = redis.llen(key)
all_elements = redis.lrange(key, 0, length)
could be replaced by
all_elements = redis.lrange(key, 0, -1)
twidi: good point. committed.
The implementations unfortunately have race conditions since redis doesn't give you transactions. Your length checks won't work reliably if multiple writers push entries into the queue and the queue size limit is reached.
If your writers don't need to notice when the queue is full you can always execute an LTRIM after your push operation. This way your queue will always stay close to the queue's limit.