Skip to content

Commit

Permalink
runner: Respect 403 errors from the API
Browse files Browse the repository at this point in the history
  • Loading branch information
victorges committed May 24, 2024
1 parent 2204bb6 commit 018480f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions task/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ func (r *runner) handleTask(ctx context.Context, taskInfo data.TaskInfo) (out *T
if err == api.ErrRateLimited {
glog.Warningf("Task execution rate limited type=%q id=%s userID=%s", taskType, taskID, taskCtx.UserID)
return nil, r.delayTaskStep(ctx, taskID, taskCtx.Step, taskCtx.StepInput)
} else if httpErr := (&api.HTTPStatusError{}); errors.As(err, &httpErr) && httpErr.StatusCode == 403 {
glog.Warningf("Task execution forbidden type=%q id=%s userID=%s error=%q", taskType, taskID, taskCtx.UserID, httpErr.Message)
return nil, fmt.Errorf("task execution forbidden: %w", httpErr)
} else if err != nil {
glog.Errorf("Error updating task progress type=%q id=%s err=%q unretriable=%v", taskType, taskID, err, IsUnretriable(err))

Check warning on line 351 in task/runner.go

View check run for this annotation

Codecov / codecov/patch

task/runner.go#L343-L351

Added lines #L343 - L351 were not covered by tests
// execute the task anyway
Expand Down

0 comments on commit 018480f

Please sign in to comment.