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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea1f7d-1b9c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea1f7d-1b9c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?