Delay In Task Execution #917
-
I have a pretty simple setup right now.
I'm using Asynq to schedule tasks and I'm starting to see a delay in response. The UI is showing that the task is executing 'now', but it lingers for a good while. My last run, I had 78 tasks scheduled at the same time and most of them didn't execute till 4-5 minutes after the expected time. This is what I'm doing in code: func (w *worker) stopCapture() {
asyncTask, err := newTaskSubmission(taskType, request, asynq.MaxRetry(MaxTaskRetry))
if err != nil {
log.Error().Err(err).Msg("Unable to create a new task")
return 0, cancelNoOp, err
}
// Update task to DB
startTime := time.Unix(scheduledTime, 0)
info, err := w.client.Enqueue(asyncTask, asynq.ProcessAt(startTime))
if err != nil {
return 0, cancelNoOp, err
}
}
func newTaskSubmission[T any](name string, request *T, opts ...asynq.Option) (*asynq.Task, error) {
if request == nil {
return nil, errors.New("invalid request received")
}
payload, err := json.Marshal(request)
if err != nil {
return nil, err
}
return asynq.NewTask(name, payload, opts...), nil
} I'm wondering if anyone else has run into this before? |
Beta Was this translation helpful? Give feedback.
Answered by
safaci2000
Oct 3, 2024
Replies: 1 comment
-
It turned out to be a silly mistake, I had this setting in my initialization. DelayedTaskCheckInterval: time.Minute * 5, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
safaci2000
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It turned out to be a silly mistake, I had this setting in my initialization.