Skip to contents

reachable means an HTTP response came back at all, whatever its status. A reachable call clears the count; the Kth consecutive unreachable one trips the breaker for the cooldown window.

Usage

breaker_record(host, reachable, now = as.numeric(Sys.time()))

Arguments

host

A hostname.

reachable

Whether an HTTP response arrived.

now

The current time in seconds since the epoch.

Value

The host's new breaker state, invisibly.

Details

Pass reachable = TRUE for any response in hand, including a 5xx and including a 2xx whose body will not parse. Only a genuine transport failure is FALSE.

Examples

breaker_reset()
breaker_record("example.org", reachable = FALSE)
breaker_record("example.org", reachable = TRUE)
breaker_open("example.org")
#> [1] FALSE