After ttl scan task finished, the heartbeat will not be updated anymore. At this time, it may be fetched by other task manager and restarted, so that this task will never be finished (unless all tasks are finished during the same period of heartbeat).
We should add more condition to the peek waiting task SQL.