Skip to content

Retry responses with status code "423 Locked" #436

@dentarg

Description

@dentarg

I want the backend to start use 423 Locked in some situations (currently 503 Service Unavailable is used).

Seeing the provider does handle 503 responses with retries, I would like if the provider did handle 423 responses with retries too, to not disrupt scenarios where the situation leading to a 423 response was transient.

case request.customRetryCode:
if _, ok := ctx.Deadline(); !ok {
return fmt.Errorf("context has no deadline")
}
tflog.Debug(ctx, fmt.Sprintf("custom retry logic, will try again, attempt=%d", request.attempt))
// Intentionally fall through to retry logic below
case 200, 201, 202, 204:
return nil
case 400, 409:
if errStr, ok := (*request.failed)["error"].(string); ok && errStr == "Timeout talking to backend" {
if _, ok := ctx.Deadline(); !ok {
return fmt.Errorf("context has no deadline")
}
tflog.Debug(ctx, fmt.Sprintf("timeout talking to backend, will try again, attempt=%d", request.attempt))
} else if msg, ok := (*request.failed)["message"].(string); ok {
return fmt.Errorf("getting %s: %s", request.resourceName, msg)
} else {
return fmt.Errorf("getting %s: %v", request.resourceName, *request.failed)
}
case 404:
tflog.Warn(ctx, fmt.Sprintf("the %s was not found", request.resourceName))
return nil
case 410:
tflog.Warn(ctx, fmt.Sprintf("the %s has been deleted", request.resourceName))
return nil
case 503:
if _, ok := ctx.Deadline(); !ok {
return fmt.Errorf("context has no deadline")
}
tflog.Debug(ctx, fmt.Sprintf("service unavailable, will try again, attempt=%d", request.attempt))
default:
return fmt.Errorf("unexpected status code: %d", response.StatusCode)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions