Questions about the redis command rpoplpush

compared to lpop, this command mainly prevents message loss. If you lpop a queue and the client crashes, the message is lost.

official description:

()

so, how to judge messages that exceed a certain time limit?

that"s what I"m doing right now.

1, rpoplpush queues, such as export from A, backup to B.
2. Zadd the resulting queue into an ordered set zset.
3. The queue is complete. Use the command lrem to remove the queue from backup queue B.

if you get to step 1, but not to step 2, the queue is missing.
so I just need to query the queues in B periodically to see if they exist in zset.

seems to be no problem. But if my detection program runs between steps 1 and 2, then there is a misjudgment.

to avoid this situation, the best way to avoid this is the official description: "messages that exceed a certain processing time limit are put back into the queue", such as a queue, which will not be detected 10 seconds after it pops up, so how to judge the time?

Jul.13,2021

found the answer himself. Maintain another zset. Put the queue of backup queue B into another zset, and check it every 15 seconds.


you can learn about beantalked

Menu