It really depends on the API call you’re making and how you’re doing so, but if you’ve like to learn more about backoff strategies, we’ve got some suggestions:
- Back off linearly for TCP/IP level network errors. These problems are generally temporary and tend to clear quickly. Increase the delay in reconnects by 250ms each attempt, up to 16 seconds.
- Back off exponentially for HTTP errors for which reconnecting would be appropriate. Start with a 5 second wait, doubling each attempt, up to 320 seconds.
- Back off exponentially for HTTP 420 errors. Start with a 1 minute wait and double each attempt. Note that every HTTP 420 received increases the time you must wait until rate limiting will no longer will be in effect for your account.
In this case, an exponential backoff and retry is likely to be the best option. If something in the Twitter backend is down, then you may find further clues about any outages here.