Maybe just introduce something like an exponential backoff algorithm if you start getting too many 5xx errors or the requests are hanging.