mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 07:25:56 +03:00
[GH-ISSUE #864] [FEATURE REQUEST] Add callback for task state changes #2451
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#2451
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 @hungtcs on GitHub (Apr 17, 2024).
Original GitHub issue: https://github.com/hibiken/asynq/issues/864
Originally assigned to: @hibiken on GitHub.
Is your feature request related to a problem? Please describe.
I'm currently working on a feature that notifies other services when a task has finished.
Unfortunately, I found that asynq doesn't provide an api for this feature.
I currently do this via middleware, but it has some flaws and doesn't work well.
One of the key issues is that the life cycle of the task does not actually end when the middleware is executed.
If another service is notified of the end of the task at this point, however, it may still be active when the other service gets the task status from the inspector.
Describe the solution you'd like
One solution is to add a global callback function that is called when the task state changes.
Describe alternatives you've considered
I'm currently using middleware, but it's not working well.
@hibare commented on GitHub (Jul 17, 2024):
Looking for same feature, probably experiment with middleware for now. Having a concrete solution would be awesome.
@kamikazechaser commented on GitHub (Oct 19, 2024):
I think the middleware should suffice, taskErr will report if it is a retry, if there is no error, you can use the inpsector to grab the latest state.