Closed JoshMock closed 1 month ago
Pinging all my dynamic language friends for a review, mostly because it's interesting. :slightly_smiling_face:
Merging mostly so I can get this in before publishing the 8.14 client. We can continue to iterate on the implementation based on how this works, especially once Elastic Cloud SREs start to see a difference in retry handling from Kibana.
Uses an exponential backoff algorithm that includes some jitter so that retries are not going to hammer several sequential requests at an Elasticsearch instance that might be failing or trying to catch up. Some random jitter is added to the backoff to ensure a more smooth distribution of retries.
A
retryBackoff
option is exposed on both the transport constructor andrequest
function, but I'm not planning to document it. Exposing it is primarily to make unit testing easier. (Who would have guessed that testing code that uses time and random numbers would be frustrating?) That said, more advanced users might see value in providing their own backoff algorithm to meet their particular needs.