mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 07:25:56 +03:00
[GH-ISSUE #441] [FEATURE REQUEST] maxArchiveSize and archivedExpirationInDays should be configurable at the server level #1215
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#1215
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghstahl on GitHub (Apr 28, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/441
Originally assigned to: @hibiken on GitHub.
Configurable MaxArchiveSize and ArchivedExpirationInDays
There are some tasks I don't care if they eventually fail and would prefer, they just get thrown away.
In my application I spin up multiple asynq servers (hosted in a go routines). Some I want to have failed tasks archived, other servers I don't care. It's a house keeping thing to not write stuff to REDIS when nobody cares about them.
I would like to configure maxArchiveSize and archivedExpirationInDays in the config
Something like this
When I don't care about the tasks, MaxArchiveSize and ArchivedExpirationInDays would be ZERO.
Alternately
Via @hibiken
If you are interested in querying all the archived tasks, and delete them programmatically, you can use Inspector.ListArchivedTasks and Inspector.DeleteTask :)
For this I would probably use the asynq scheduled tasks to wipe out those tasks in archives I don't care about.
@hibiken commented on GitHub (May 10, 2022):
@ghstahl Thank you for opening this issue.
I think it makes sense to allow customizing those parameters via Config.
But does it make more sense for your use case to return a sentinel error from the Handler to tell Asynq not to store the failed task in archive? We can similar one called
SkipRetrywhich skips any remaining retries and sends the task directly to archive. Maybe we could introduce another sentinel error to indicate Asynq to drop the task?@ghstahl commented on GitHub (May 10, 2022):
The handlers in the design have no knowledge of the context in which they are used. For a particular server, returning errors is just fine and it's fine to flow into the archive. For another server, with the handlers behaving the same way, we want the archive excluded.
The issue that popped out to me going down the sentinel error path is that normal errors emitted from the handler are fine as long as we are in the Retry window. For the handler to return the "Don't archive me" error is to know that this is the "last" retry and also the business context of which they were called.
I can see the sentinel error technique being used when handlers are designed to have way more knowledge than I give them and needing to know from asynq that we are at the end.
@roccoblues commented on GitHub (Jul 29, 2022):
Hi @hibiken,
as mentioned here I started making those parameters configurable.
However I quickly realized that it's not so easy because there can be at least 3 triggers of the archiving:
asynq.processorin theasynq.Server. This is the easy one, here we have the config and can initialize therdb.RDBwith the correct values.asynq.Inspectorwhich can be used in custom code.asynq.Inspector.The problem is that I don't see a way to configure all cases together. And if we don't do that the behavior will be totally confusing.
Any ideas?
@ghstahl commented on GitHub (Jul 29, 2022):
Hi, I needed these 2 specifically to get me unstuck
https://github.com/fluffy-bunny/asynq
github.com/fluffy-bunny/asynq@a5681d48b5/internal/rdb/rdb.go (L33)The technique I used was to target these 2 configs only.
If the value is nil use the defaults as before.
Don't archive anything based upon the configs.
I hastily did this, so I didn't think it would be accepted as main as it is. I would appreciate your feedback on the technique.
@bojanz commented on GitHub (Aug 30, 2023):
Big +1 to this feature request.
I do not want tasks to be archived at all, but right now there is no way to do that.
@ghstahl commented on GitHub (Jan 2, 2024):
Tangentially related
https://github.com/hibiken/asynq/issues/756