Handbook
Glossary
exponential-backoff-from ( quot: ( -- success? ) max-seconds max-count/f n -- )
Vocabulary
backoff
Inputs
quot
a
quotation
with stack effect
( -- success? )
max-seconds
an
object
max-count/f
an
object
n
an
object
Outputs
None
Definition
USING:
calendar
combinators.short-circuit
kernel
math
math.order
shuffle
threads
;
IN:
backoff
:
exponential-backoff-from
( quot: ( -- success? ) max-seconds max-count/f n -- )
2dup
{
[
drop
]
[
<=
]
}
2&&
[
4drop
]
[
[
nip
2^
min
seconds
sleep
call
]
4keep
5roll
[
4drop
]
[
1
+
exponential-backoff-from
]
if
]
if
;
inline
recursive