seomoz / qless-core

Core Lua Scripts for qless
MIT License
85 stars 33 forks source link

Documentation regarding priority is incorrect #37

Open stuartcarnie opened 10 years ago

stuartcarnie commented 10 years ago

The documentation indicates a lower value indicates more priority, which is incorrect according to implementation.

Items are added to a sorted set using the following formula, where priority defaults to 0:

score = priority - (now / 10000000000)

Using current unix time stamps means typically items are scored with negative numbers like -0.1383766174 and getting smaller. Items are popped off using ZREVRANGE, which sorts from largest to smallest. If we set a negative priority, the item will not be fetched until the queue is empty, given that even a priority of -1 will make it considerably smaller than the default values.