Fitting Retries Within a Total Deadline

Several attempts and their waits must fit the caller's deadline if the operation promises a bounded elapsed time.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Budget a small example
  2. Test with a controlled clock

Budget a small example

With a five-second limit, an initial attempt taking two seconds and a one-second wait leave two seconds for all remaining work. A new five-second timeout would exceed the original budget. Time units should be shared across those calculations.

Test with a controlled clock

Supply observed times near the deadline and verify the maximum time given to the next attempt. See fake clocks for checking the logic without waiting.[1]

References

  1. Python Software Foundation, Python Tutorial: Errors and Exceptions ↩