How to solve the problem of redis queue consumption failure and repeated consumption

I am currently using redis for message queuing. Because it takes a long time to perform some tasks, a server restart may cause queue consumption to fail.
for example, the process to be performed is as follows:

1. Queue pop-up task
2. Put the task in a zset and judge that the zset, is still there for more than 5 minutes, then join the queue and consume again.
3, consumption task
4, task consumption completed, which is removed from the zset.

what is the problem now? Suppose step 3 lasts for 10 minutes, but zset determines that the queue is dead after more than 5 minutes. So put it back on the mission.
this cycle results in multiple task consumption.
you may want to ask, can"t you just set the time a little longer? It doesn"t matter whether the time is too long or too short, the time is too long, the task waiting time is too long.
and the execution time of each task is uncertain, some 1 minute, some 30 seconds, and 15 minutes in special cases.
forgot to mention that there are dozens of servers in a distributed environment.

< hr >

I now imagine a solution, and the root of the problem now lies in whether the task is running or not. So I"m thinking about starting here.
so how do you tell if this task is still running? I"m considering maintaining a tasklist queue. Submit to redis every 1 second. At the same time, remove tasks that have not been reported for 5 seconds on a regular basis. When the
task resumes, determine if the task exists in the list.

Apr.08,2021

1.
2, do a blist, insert task
3, cancel the alist task
4, finish the cancellation, and export the blist.. Failed, insert alist

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-1e5d133-456de.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-1e5d133-456de.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?