mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-25 23:15:51 +03:00
[GH-ISSUE #773] How to synchronize task information between asynq and database? #2403
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#2403
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 @Milk-Tang on GitHub (Oct 31, 2023).
Original GitHub issue: https://github.com/hibiken/asynq/issues/773
Goal
I want to sync the task info to my database from asynq, so that I can do more complex indexing.
Attempts has made
task stateandretry countProblem
Is there any way for me to achieve my goal?
@kamikazechaser commented on GitHub (Oct 31, 2023):
You can use Inspector.GetTaskInfo if ypu know the ID. The TaskInfo returned has verbose info on the task.
@Milk-Tang commented on GitHub (Oct 31, 2023):
Thank you for your reply, but using this cannot avoid only obtaining task that have not yet changed their state in the Handler func .
What I want is the task state after this worker consumption, as well as the
retry countand other information@kamikazechaser commented on GitHub (Nov 1, 2023):
From what I can see
TaskInfocontains the state and retried metadata.How you determine when to collect this info is up to you. You can keep polling in a separate routine (Much easier if you pass your own ID when queueing). You could defer queue another Task which then fetches the TaskInfo within your main handler.
@Milk-Tang commented on GitHub (Nov 2, 2023):
Okay, if there's no better way, I'll add the task ID to the queue after each task processing, and starting a new worker to synchronize the task information in this queue.
But there is also a problem with this: the task will be deleted after completion, and I must set the task retention time to reduce the probability of the task being deleted
@kamikazechaser commented on GitHub (Nov 3, 2023):
Right. I don't think there is a way around this.