Difference between revisions of "Exponential backoff"

From wikieduonline
Jump to navigation Jump to search
Line 1: Line 1:
 
[[wikipedia:Exponential backoff]]
 
[[wikipedia:Exponential backoff]]
 +
 +
<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>
 +
  
  

Revision as of 09:12, 11 November 2022

wikipedia:Exponential backoff

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

Advertising: