The exponential-backoff Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The exponential-backoff Reference Manual

This is the exponential-backoff Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 08:37:21 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Exponential backoff

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.

Example

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...

License

MIT


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 exponential-backoff

Author

death <github.com/death>

License

MIT

Description

An implementation of the exponential backoff algorithm

Source

exponential-backoff.asd (file)

Component

exponential-backoff.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 exponential-backoff.asd

Location

exponential-backoff.asd

Systems

exponential-backoff (system)


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 exponential-backoff/exponential-backoff.lisp

Parent

exponential-backoff (system)

Location

exponential-backoff.lisp

Packages

exponential-backoff

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 exponential-backoff

Source

exponential-backoff.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: with-exponential-backoff (BACKOFF &rest OPTIONS &key SLEEP-FUNCTION MAX-RETRIES RESET) &body FORMS
Package

exponential-backoff

Source

exponential-backoff.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: exponential-backoff &key NUM-FAILURES-TO-IGNORE INITIAL-DELAY-MS MULTIPLY-FACTOR JITTER-FACTOR MAX-BACKOFF-MS ALWAYS-USE-INITIAL-DELAY
Package

exponential-backoff

Source

exponential-backoff.lisp (file)

Function: inform BACKOFF SUCCEEDED
Package

exponential-backoff

Source

exponential-backoff.lisp (file)

Function: reset BACKOFF
Package

exponential-backoff

Source

exponential-backoff.lisp (file)

Function: time-until-release BACKOFF
Package

exponential-backoff

Source

exponential-backoff.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: call-with-exponential-backoff FN BACKOFF &key SLEEP-FUNCTION MAX-RETRIES RESET
Package

exponential-backoff

Source

exponential-backoff.lisp (file)

Function: now ()
Package

exponential-backoff

Source

exponential-backoff.lisp (file)

Function: release-time BACKOFF
Package

exponential-backoff

Source

exponential-backoff.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   E   F   L  
Index Entry  Section

E
exponential-backoff.asd: The exponential-backoff<dot>asd file
exponential-backoff/exponential-backoff.lisp: The exponential-backoff/exponential-backoff<dot>lisp file

F
File, Lisp, exponential-backoff.asd: The exponential-backoff<dot>asd file
File, Lisp, exponential-backoff/exponential-backoff.lisp: The exponential-backoff/exponential-backoff<dot>lisp file

L
Lisp File, exponential-backoff.asd: The exponential-backoff<dot>asd file
Lisp File, exponential-backoff/exponential-backoff.lisp: The exponential-backoff/exponential-backoff<dot>lisp file

Jump to:   E   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   E   F   I   M   N   R   T   W  
Index Entry  Section

C
call-with-exponential-backoff: Internal functions

E
exponential-backoff: Exported functions

F
Function, call-with-exponential-backoff: Internal functions
Function, exponential-backoff: Exported functions
Function, inform: Exported functions
Function, now: Internal functions
Function, release-time: Internal functions
Function, reset: Exported functions
Function, time-until-release: Exported functions

I
inform: Exported functions

M
Macro, with-exponential-backoff: Exported macros

N
now: Internal functions

R
release-time: Internal functions
reset: Exported functions

T
time-until-release: Exported functions

W
with-exponential-backoff: Exported macros

Jump to:   C   E   F   I   M   N   R   T   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   E   P   S  
Index Entry  Section

E
exponential-backoff: The exponential-backoff system
exponential-backoff: The exponential-backoff package

P
Package, exponential-backoff: The exponential-backoff package

S
System, exponential-backoff: The exponential-backoff system

Jump to:   E   P   S