Difference between revisions of "Exponential backoff"
Jump to navigation
Jump to search
(3 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
+ | * [[AWS SDK]], https://docs.aws.amazon.com/general/latest/gr/api-retries.html | ||
+ | <pre> | ||
+ | Do some asynchronous operation. | ||
+ | |||
+ | retries = 0 | ||
+ | |||
+ | DO | ||
+ | wait for (2^retries * 100) milliseconds | ||
+ | |||
+ | status = Get the result of the asynchronous operation. | ||
+ | |||
+ | IF status = SUCCESS | ||
+ | retry = false | ||
+ | ELSE IF status = NOT_READY | ||
+ | retry = true | ||
+ | ELSE IF status = THROTTLED | ||
+ | retry = true | ||
+ | ELSE | ||
+ | Some other error occurred, so stop calling the API. | ||
+ | retry = false | ||
+ | END IF | ||
+ | |||
+ | retries = retries + 1 | ||
+ | |||
+ | WHILE (retry AND (retries < MAX_RETRIES)) | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
+ | ==See also== | ||
+ | *{{Exponential backoff}} | ||
[[Category:Scheduling algorithms]] | [[Category:Scheduling algorithms]] |
Latest revision as of 09:13, 11 November 2022
Do some asynchronous operation. retries = 0 DO wait for (2^retries * 100) milliseconds status = Get the result of the asynchronous operation. IF status = SUCCESS retry = false ELSE IF status = NOT_READY retry = true ELSE IF status = THROTTLED retry = true ELSE Some other error occurred, so stop calling the API. retry = false END IF retries = retries + 1 WHILE (retry AND (retries < MAX_RETRIES))
See also[edit]
Advertising: