replicate-swift
replicate-swift copied to clipboard
Add automatic retry policy
This PR refactors the client's internal fetch method to automatically retry requests as appropriate (429 status code, as well as 5xx errors for GET requests). If the server sends a Retry-After header, that value is used. Otherwise, the function delays for a configured interval with exponential backoff and jitter.
This should all be in line with the retry logic in the Python client.
Blocked by test cases not supporting different responses.