[GH-ISSUE #316] [FEATURE REQUEST] Schedule for retry / mark task as process later #2160

Closed
opened 2026-03-15 19:27:39 +03:00 by kerem · 1 comment
Owner

Originally created by @sdklab007 on GitHub (Aug 24, 2021).
Original GitHub issue: https://github.com/hibiken/asynq/issues/316

Originally assigned to: @hibiken on GitHub.

Is your feature request related to a problem? Please describe.
Currently, we are using Asynq for checking the status of the transaction that gets proceed by another system. Sometimes the transaction goes on the "PENDING" status, hence we would want Asynq to retry until the transaction status is either FAILED/SUCCESS.

Describe the solution you'd like
Ability to retry the task without creating an Error. Since the error rate would increase when it's actually not an error.

Describe alternatives you've considered
We are currently returning an error if the transaction status is "PENDING" so that Asynq can retry the task by itself. The problem here is, the Error rate will increase, overall its not even an error here, we only want to say Asynq to retry this task later.

func HandleTransactionStatusTask(ctx context.Context, t *asynq.Task) error {
    var p MyPayLoad
    if err := json.Unmarshal(t.Payload(), &p); err != nil {
        return fmt.Errorf("json.Unmarshal failed: %v: %w", err, asynq.SkipRetry)
    }
   // result of some external API call 
   if result == "PENDING" {
       return  errors.New("Still pending"),
   }
    return nil
}
Originally created by @sdklab007 on GitHub (Aug 24, 2021). Original GitHub issue: https://github.com/hibiken/asynq/issues/316 Originally assigned to: @hibiken on GitHub. **Is your feature request related to a problem? Please describe.** Currently, we are using Asynq for checking the status of the transaction that gets proceed by another system. Sometimes the transaction goes on the "PENDING" status, hence we would want Asynq to retry until the transaction status is either FAILED/SUCCESS. **Describe the solution you'd like** Ability to retry the task without creating an Error. Since the error rate would increase when it's actually not an error. **Describe alternatives you've considered** We are currently returning an error if the transaction status is "PENDING" so that Asynq can retry the task by itself. The problem here is, the Error rate will increase, overall its not even an error here, we only want to say Asynq to retry this task later. ``` func HandleTransactionStatusTask(ctx context.Context, t *asynq.Task) error { var p MyPayLoad if err := json.Unmarshal(t.Payload(), &p); err != nil { return fmt.Errorf("json.Unmarshal failed: %v: %w", err, asynq.SkipRetry) } // result of some external API call if result == "PENDING" { return errors.New("Still pending"), } return nil } ```
kerem 2026-03-15 19:27:39 +03:00
Author
Owner

@hibiken commented on GitHub (Aug 25, 2021):

@sdklab007 Thank you for opening this issue!
I responded in the issue #273, please take a look!

This is a duplicate of #273 I'll close this one and move the discussion to the other issue.

<!-- gh-comment-id:905490517 --> @hibiken commented on GitHub (Aug 25, 2021): @sdklab007 Thank you for opening this issue! I responded in the issue #273, please take a look! This is a duplicate of #273 I'll close this one and move the discussion to the other issue.
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#2160
No description provided.