RPUSH appends one or more values to the right end of a Redis list. In a queue, it adds new tasks at the back so workers can process them in arrival order. section 10.1.1
Use RPUSH with a queue-processing pattern:
- Append tasks with RPUSH to the queue’s right side. section 10.1.1
- Have workers use BLPOP to remove tasks from the left side and wait when the queue is empty. section 10.1.1
- Avoid busy waiting because Redis performs the blocking wait. section 10.1.1
Adding background tasks
A Python producer calls r.rpush('queue:task', iterations) for ten calculation tasks, then checks the remaining queue depth with llen. Worker Pods consume those tasks with BLPOP.
