[GH-ISSUE #1039] [BUG] How to clean up leftover data after a run #490

Open
opened 2026-03-02 05:21:33 +03:00 by kerem · 3 comments
Owner

Originally created by @Harvi-C on GitHub (Mar 27, 2025).
Original GitHub issue: https://github.com/hibiken/asynq/issues/1039

Originally assigned to: @hibiken, @kamikazechaser on GitHub.

I found that if my server terminates abnormally, Redis will leave a lot of unprocessed task data. Will this data be automatically checked and cleaned up after the next server startup? Because I found that these data have no expiration time set,

I am now manually calling the Inspector to process, but some counting-related statistics will be left, and I don’t know whether more keys will be generated as the system runs. Is there any elegant way to clean it up?

Image

Originally created by @Harvi-C on GitHub (Mar 27, 2025). Original GitHub issue: https://github.com/hibiken/asynq/issues/1039 Originally assigned to: @hibiken, @kamikazechaser on GitHub. I found that if my server terminates abnormally, Redis will leave a lot of unprocessed task data. Will this data be automatically checked and cleaned up after the next server startup? Because I found that these data have no expiration time set, I am now manually calling the Inspector to process, but some counting-related statistics will be left, and I don’t know whether more keys will be generated as the system runs. Is there any elegant way to clean it up? ![Image](https://github.com/user-attachments/assets/dfc0eff4-9916-4f25-b753-ae829cb40999)
Author
Owner

@Harvi-C commented on GitHub (Mar 27, 2025):

这是我现在的处理方式,但它不够彻底:

Image
<!-- gh-comment-id:2757514968 --> @Harvi-C commented on GitHub (Mar 27, 2025): 这是我现在的处理方式,但它不够彻底: <img width="634" alt="Image" src="https://github.com/user-attachments/assets/60d9eda6-7d51-457a-b3ce-18d049c3fb76" />
Author
Owner

@ronge1012 commented on GitHub (Apr 25, 2025):

请问这个关于删除processed这个选项搞定了吗

<!-- gh-comment-id:2829465631 --> @ronge1012 commented on GitHub (Apr 25, 2025): 请问这个关于删除processed这个选项搞定了吗
Author
Owner

@kamikazechaser commented on GitHub (May 5, 2025):

Are you on version v0.25.0+? Have you tried using the retention option? It should clear completed tasks. As for the others (archived, retry and scheduled) the behavior is different. I wouldn't delete those 3 automatically, they need to be manually inspected so your approach of using the inspector is fine because for you, it is safe to delete those 3, for the majority it is not.

<!-- gh-comment-id:2850473200 --> @kamikazechaser commented on GitHub (May 5, 2025): Are you on version v0.25.0+? Have you tried using the retention option? It should clear completed tasks. As for the others (archived, retry and scheduled) the behavior is different. I wouldn't delete those 3 automatically, they need to be manually inspected so your approach of using the inspector is fine because for you, it is safe to delete those 3, for the majority it is not.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#490
No description provided.