package
1.0.0
Repository: https://github.com/onflow/flow-emulator.git
Documentation: pkg.go.dev

# README

Liveness Checks Helper

For applications that need to perform liveness checks, this utility creates a simple object capable of checking in with multiple routines.

Usage

The suggested usage is to create a collector and then spawn checks from it to use in your application.

Each worker gets a single Check to work from, and the collector itself is registered as an HTTP handler to respond to liveness probes.

multiCheck := liveness.NewCheckCollector(time.Second)

http.Handle("/live", multiCheck)

go worker1(multiCheck.NewCheck())
go worker2(multiCheck.NewCheck())

check3 = multiCheck.NewCheck()

for {
    check3.CheckIn()
    // do work
    // ...
}

# Functions

NewCheckCollector creates a threadsafe Collector.

# Constants

DefaultTolerance is the default time (in seconds) allowed between heartbeats.
ToleranceHeader is the HTTP header name used to override a collector's configured tolerance.

# Structs

CheckCollector produces multiple checks and returns live only if all descendant checks are live.

# Interfaces

Check is a heartbeat style liveness reporter.