Developer Fixes Duplicate Batch Jobs Caused by Misleading 500 Errors on 429 Retries
A developer encountered a bug where sequential image generation requests to an external API triggered 429 rate-limit errors due to concurrent job limits. When the server returned a generic 500 response, clients assumed the entire batch had failed and resubmitted all requests, duplicating jobs already accepted by the external service. The fix involved retrying only 429-specific errors server-side, skipping items that failed after five attempts, and returning successful results alongside failures in a single response. The updated endpoint returns HTTP 200 with separate arrays for accepted and failed items, as long as at least one request succeeded. This approach preserves external job IDs, prevents duplicate submissions, and allows clients to selectively retry only the items that actually failed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in