ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Supervision

Description

Supervision policies and bounded retry pacing.

Synopsis

The combinator

superviseLoop :: (MonadUnliftIO m, KatipContext m) => SupervisionPolicy -> m () -> m Void Source #

Repeat the step, resetting backoff after success. Cancellation propagates.

superviseBackground :: Text -> LogEnv -> IO () -> IO () Source #

Run a background loop that never fails up: every escaped fault backs off and the step reruns. Pacing lives in the step, and the loop logs under the label's namespace.

superviseUnder :: SupervisionPolicy -> LogEnv -> IO () -> IO () Source #

Run a background loop under a policy, logging under the policy's label.

data SupervisionPolicy Source #

Classify escaped synchronous faults and set the retry pace.

Constructors

SupervisionPolicy 

Fields

transientPolicy :: Text -> BackoffSchedule -> SupervisionPolicy Source #

Retry every escaped synchronous fault at the supplied pace.

data FaultDisposition Source #

Synchronous fault policy. Asynchronous cancellation always propagates.

Constructors

Transient

Log at WarningS, back off (bounded exponential), rerun the step.

Permanent

Rethrow: fail up to the process supervisor, taking the process down.

Bounded exponential backoff

data BackoffSchedule Source #

Consecutive failures double the base delay up to the cap.

Constructors

BackoffSchedule 

Fields

backoffMicros :: BackoffSchedule -> Int -> Int Source #

Compute the retry delay in microseconds, bounded by the schedule cap.

backgroundLoopBackoff :: BackoffSchedule Source #

Retry background faults from one second to a thirty-second cap.

Bounded retry pacing

delayListPolicy :: forall (m :: Type -> Type). Monad m => [Int] -> RetryPolicyM m Source #

Use explicit microsecond delays as a finite retry budget.