[GH-ISSUE #508] [BUG] Deleting a queue leaves behind processed counts #1249

Open
opened 2026-03-07 22:07:58 +03:00 by kerem · 4 comments
Owner

Originally created by @tschaub on GitHub (Jul 6, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/508

Originally assigned to: @hibiken on GitHub.

Describe the bug
After deleting a queue, I expected Redis keys associated with that queue to be deleted. It looks like the processed counts are left behind, so when a new queue is created with the same name, it starts with the old processed counts.

To Reproduce

  1. Process some tasks using the default queue
  2. inspector.DeleteQueue("default", true)
  3. See keys like asynq:{default}:processed and asynq:{default}:processed:2022-07-06 left behind.

Expected behavior
After using the inspector to delete a queue, I expected that data associated with that queue would be removed. When I later created a new queue with the same name (default), I expected the processed count (e.g. visible in the dashboard) to be zero. Instead, I found that the new queue started with the old count of processed tasks.

Environment:

  • macOS 12.4
  • github.com/hibiken/asynq v0.23.0

I'm not sure if this is a bug or user error. If there is another way to clean up after processing, I can help make that clearer in the documentation.

Originally created by @tschaub on GitHub (Jul 6, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/508 Originally assigned to: @hibiken on GitHub. **Describe the bug** After deleting a queue, I expected Redis keys associated with that queue to be deleted. It looks like the processed counts are left behind, so when a new queue is created with the same name, it starts with the old processed counts. **To Reproduce** 1. Process some tasks using the `default` queue 2. `inspector.DeleteQueue("default", true)` 3. See keys like `asynq:{default}:processed` and `asynq:{default}:processed:2022-07-06` left behind. **Expected behavior** After using the inspector to delete a queue, I expected that data associated with that queue would be removed. When I later created a new queue with the same name (`default`), I expected the processed count (e.g. visible in the dashboard) to be zero. Instead, I found that the new queue started with the old count of processed tasks. **Environment:** - macOS 12.4 - `github.com/hibiken/asynq v0.23.0` I'm not sure if this is a bug or user error. If there is another way to clean up after processing, I can help make that clearer in the documentation.
Author
Owner

@tschaub commented on GitHub (Jul 6, 2022):

I'm guessing that something like github.com/tschaub/asynq@88dedc2438 could be the start of a fix. It looks like the existing test doesn't result in any processed tasks, so it doesn't really serve as a regression test.

<!-- gh-comment-id:1176501703 --> @tschaub commented on GitHub (Jul 6, 2022): I'm guessing that something like https://github.com/tschaub/asynq/commit/88dedc243838176abc17e9628125a957e5ef1583 could be the start of a fix. It looks like the existing test doesn't result in any processed tasks, so it doesn't really serve as a regression test.
Author
Owner

@hibiken commented on GitHub (Jul 9, 2022):

@tschaub Thank you for reporting this bug!
Please feel free to open a PR if you are willing to work on it (Please assign the issue to yourself, if you're working on it) If not, I can get to it in a couple of weeks.

<!-- gh-comment-id:1179571650 --> @hibiken commented on GitHub (Jul 9, 2022): @tschaub Thank you for reporting this bug! Please feel free to open a PR if you are willing to work on it (Please assign the issue to yourself, if you're working on it) If not, I can get to it in a couple of weeks.
Author
Owner

@SaltySooda commented on GitHub (Jul 13, 2022):

for asynq:{default}:processed , I add ProcessedTotalKey.but for asynq:{default}:processed:2022-07-06,I don't know how to get time param for ProcessedKey
please check #514

<!-- gh-comment-id:1182685110 --> @SaltySooda commented on GitHub (Jul 13, 2022): for `asynq:{default}:processed` , I add **ProcessedTotalKey**.but for `asynq:{default}:processed:2022-07-06`,I don't know how to get time param for `ProcessedKey` please check #514
Author
Owner

@arttor commented on GitHub (Dec 2, 2025):

Added a PR to fix queue cleanup #1088

@hibiken , @kamikazechaser can you please take a look?

<!-- gh-comment-id:3602781152 --> @arttor commented on GitHub (Dec 2, 2025): Added a PR to fix queue cleanup #1088 @hibiken , @kamikazechaser can you please take a look?
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#1249
No description provided.