Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the exponential-backoff Reference Manual, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 16:00:51 2021 GMT+0.
• Introduction | What exponential-backoff is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
An implementation of the exponential backoff algorithm in Common Lisp.
Inspired by the implementation found in Chromium. Read the header file to learn about each of the parameters.
If you like to SLEEP or otherwise block, and don't care to signal errors until giving up:
(defun noisy-sleep (seconds)
(format t "Sleeping for ~A seconds.~%" seconds)
(sleep seconds))
(exponential-backoff:with-exponential-backoff ((:initial-delay-ms 1000 :jitter-factor 0.1)
:max-retries 3 :sleep-function #'noisy-sleep)
(format t "Trying...~%")
(error "Something bad happened."))
;; Output:
;;
;; Trying...
;; Sleeping for 0.9575 seconds.
;; Trying...
;; Sleeping for 1.8265 seconds.
;; Trying...
;; Sleeping for 3.855 seconds.
;; Trying...
;; ; Evaluation aborted on #<SIMPLE-ERROR "Something bad happened." {1009EB9E83}>.
A more involved example that uses the backoff information by itself:
(loop with b = (exponential-backoff:exponential-backoff
:num-failures-to-ignore 1
:initial-delay-ms (* 5 1000)
:jitter-factor 0.1
:max-backoff-ms (* 5 60 1000))
for time-to-wait = (exponential-backoff:time-until-release b)
for will-succeed in '(t nil nil nil t nil nil t t nil nil)
do (format t "Waiting for ~F ms before ~:[failing~;succeeding~]...~%" time-to-wait will-succeed)
do (sleep (/ time-to-wait 1000))
do (exponential-backoff:inform b will-succeed))
;; Output:
;;
;; Waiting for 0.0 ms before succeeding...
;; Waiting for 0.0 ms before failing...
;; Waiting for 0.0 ms before failing...
;; Waiting for 4647.0 ms before failing...
;; Waiting for 9893.5 ms before succeeding...
;; Waiting for 0.0 ms before failing...
;; Waiting for 9357.5 ms before failing...
;; Waiting for 18710.0 ms before succeeding...
;; Waiting for 0.0 ms before succeeding...
;; Waiting for 0.0 ms before failing...
;; Waiting for 9969.0 ms before failing...
MIT
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The exponential-backoff system |
death
MIT
An implementation of the exponential backoff algorithm
exponential-backoff.asd (file)
exponential-backoff.lisp (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The exponential-backoff.asd file | ||
• The exponential-backoff/exponential-backoff.lisp file |
Next: The exponential-backoff/exponential-backoff․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
exponential-backoff.asd
exponential-backoff (system)
Previous: The exponential-backoff․asd file, Up: Lisp files [Contents][Index]
exponential-backoff (system)
exponential-backoff.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The exponential-backoff package |
exponential-backoff.lisp (file)
common-lisp
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported macros | ||
• Exported functions |
Next: Exported functions, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
exponential-backoff.lisp (file)
Previous: Exported macros, Up: Exported definitions [Contents][Index]
exponential-backoff.lisp (file)
exponential-backoff.lisp (file)
exponential-backoff.lisp (file)
exponential-backoff.lisp (file)
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal functions |
Previous: Internal definitions, Up: Internal definitions [Contents][Index]
exponential-backoff.lisp (file)
exponential-backoff.lisp (file)
exponential-backoff.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | E F L |
---|
Jump to: | E F L |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | C E F I M N R T W |
---|
Jump to: | C E F I M N R T W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | E P S |
---|
Jump to: | E P S |
---|