[GH-ISSUE #611] [FEATURE REQUEST] Add callback-function after task is done #298

Open
opened 2026-03-02 05:20:17 +03:00 by kerem · 5 comments
Owner

Originally created by @Lilihx on GitHub (Feb 6, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/611

Originally assigned to: @hibiken on GitHub.

Is your feature request related to a problem? Please describe.
I need a callback to notice consumer after the worker task done.
Does asynq have a callback ?

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Originally created by @Lilihx on GitHub (Feb 6, 2023). Original GitHub issue: https://github.com/hibiken/asynq/issues/611 Originally assigned to: @hibiken on GitHub. **Is your feature request related to a problem? Please describe.** I need a callback to notice consumer after the worker task done. Does asynq have a callback ? **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here.
Author
Owner

@bfwbbrj commented on GitHub (Mar 17, 2023):

Can you share some background information? What would the use case be like?

<!-- gh-comment-id:1473377228 --> @bfwbbrj commented on GitHub (Mar 17, 2023): Can you share some background information? What would the use case be like?
Author
Owner

@lee3164 commented on GitHub (Mar 27, 2023):

Can you share some background information? What would the use case be like?

Sometimes, we need to schedule task B after task A is done

<!-- gh-comment-id:1485017359 --> @lee3164 commented on GitHub (Mar 27, 2023): > Can you share some background information? What would the use case be like? Sometimes, we need to schedule task B after task A is done
Author
Owner

@lee3164 commented on GitHub (Mar 27, 2023):

Can you share some background information? What would the use case be like?

Sometimes, we need to schedule task B after task A is done

<!-- gh-comment-id:1485017370 --> @lee3164 commented on GitHub (Mar 27, 2023): > Can you share some background information? What would the use case be like? Sometimes, we need to schedule task B after task A is done
Author
Owner

@bfwbbrj commented on GitHub (Mar 28, 2023):

Can you share some background information? What would the use case be like?

Sometimes, we need to schedule task B after task A is done

In this case, I believe simply calling asynq.Client.Enqueue after task A is done would satisfy your needs.

<!-- gh-comment-id:1486402093 --> @bfwbbrj commented on GitHub (Mar 28, 2023): > > Can you share some background information? What would the use case be like? > > Sometimes, we need to schedule task B after task A is done In this case, I believe simply calling `asynq.Client.Enqueue` after task A is done would satisfy your needs.
Author
Owner

@lee3164 commented on GitHub (Mar 28, 2023):

Yes, because this is a simple case. If we have such a feature, we can get many benefits from it.

  1. Our code is clean, and our schedule logic is in the same place, for example:
func schedule(ctx) {
    client.Enqueue(ctx, taskA)
    client.Enqueue(ctx, taskB, After(TaskA))
    client.Enqueue(ctx, taskC, After(TaskB))
}
  1. In some cases, we need more complicated and fine control. for example:
func schedule(ctx) {
    client.Enqueue(ctx, taskA)
    client.Enqueue(ctx, taskB)
    client.Enqueue(ctx, taskC, After(TaskA, TaskB))
}
<!-- gh-comment-id:1486428845 --> @lee3164 commented on GitHub (Mar 28, 2023): Yes, because this is a simple case. If we have such a feature, we can get many benefits from it. 1. Our code is clean, and our schedule logic is in the same place, for example: ``` func schedule(ctx) { client.Enqueue(ctx, taskA) client.Enqueue(ctx, taskB, After(TaskA)) client.Enqueue(ctx, taskC, After(TaskB)) } ``` 2. In some cases, we need more complicated and fine control. for example: ``` func schedule(ctx) { client.Enqueue(ctx, taskA) client.Enqueue(ctx, taskB) client.Enqueue(ctx, taskC, After(TaskA, TaskB)) } ```
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#298
No description provided.