| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Supervision.Internal
Description
Background supervision with typed fault classification and bounded retry pacing.
Synopsis
- superviseLoop :: (MonadUnliftIO m, KatipContext m) => SupervisionPolicy -> m () -> m Void
- superviseLoopWithDelay :: (MonadUnliftIO m, KatipContext m) => (Int -> m ()) -> SupervisionPolicy -> m () -> m Void
- superviseBackground :: Text -> LogEnv -> IO () -> IO ()
- superviseUnder :: SupervisionPolicy -> LogEnv -> IO () -> IO ()
- data SupervisionPolicy = SupervisionPolicy {}
- transientPolicy :: Text -> BackoffSchedule -> SupervisionPolicy
- data FaultDisposition
- data BackoffSchedule = BackoffSchedule {
- bsBaseMicros :: Int
- bsCapMicros :: Int
- backoffMicros :: BackoffSchedule -> Int -> Int
- backgroundLoopBackoff :: BackoffSchedule
- delayListPolicy :: forall (m :: Type -> Type). Monad m => [Int] -> RetryPolicyM m
The combinator
superviseLoop :: (MonadUnliftIO m, KatipContext m) => SupervisionPolicy -> m () -> m Void Source #
Repeat the step, resetting backoff after success. Cancellation propagates.
superviseLoopWithDelay :: (MonadUnliftIO m, KatipContext m) => (Int -> m ()) -> SupervisionPolicy -> m () -> m Void Source #
Run the same supervision policy with caller-supplied retry pacing.
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 |
| Permanent | Rethrow: fail up to the process supervisor, taking the process down. |
Instances
| Show FaultDisposition Source # | |
Defined in Ecluse.Core.Supervision.Internal Methods showsPrec :: Int -> FaultDisposition -> ShowS # show :: FaultDisposition -> String # showList :: [FaultDisposition] -> ShowS # | |
| Eq FaultDisposition Source # | |
Defined in Ecluse.Core.Supervision.Internal Methods (==) :: FaultDisposition -> FaultDisposition -> Bool # (/=) :: FaultDisposition -> FaultDisposition -> Bool # | |
Bounded exponential backoff
data BackoffSchedule Source #
Consecutive failures double the base delay up to the cap.
Constructors
| BackoffSchedule | |
Fields
| |
Instances
| Show BackoffSchedule Source # | |
Defined in Ecluse.Core.Supervision.Internal Methods showsPrec :: Int -> BackoffSchedule -> ShowS # show :: BackoffSchedule -> String # showList :: [BackoffSchedule] -> ShowS # | |
| Eq BackoffSchedule Source # | |
Defined in Ecluse.Core.Supervision.Internal Methods (==) :: BackoffSchedule -> BackoffSchedule -> Bool # (/=) :: BackoffSchedule -> BackoffSchedule -> Bool # | |
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.