arbiter-worker-0.1.0.0
arbiter-worker
Safe HaskellNone
LanguageGHC2024

Arbiter.Worker.Reaper

Description

Internal to the arbiter packages. Not covered by the PVP. runMaintenancePass and MaintenancePace are public through Arbiter.Worker.

Schema-wide maintenance coordinated across worker pools.

Synopsis

Documentation

reaperLoop :: (RegistryAdmissionPolicies (RegistryOf m), MonadArbiter m, RegistryTables (RegistryOf m)) => LogConfig -> (MaintenanceOp -> Int64 -> m ()) -> MaintenancePace -> NominalDiffTime -> m ()Source #

Run schema-wide maintenance, with each operation independently gated across all worker pools.

runMaintenancePass :: (RegistryAdmissionPolicies (RegistryOf m), MonadArbiter m, RegistryTables (RegistryOf m)) => LogConfig -> (MaintenanceOp -> Int64 -> m ()) -> MaintenancePace -> NominalDiffTime -> m [MaintenanceOp]Source #

One pass of the maintenance the reaper runs, with each operation independently gated across all callers. An operation whose window has not elapsed is skipped. The pass covers every queue in the schema (schemaQueues), not only the caller's registry. Which caller wins a gate does not change the result. Returns the operations that threw. A failure for one queue is logged and not returned. A failure does not stop the pass. When the schema's queues cannot be read, no operation runs and every operation is returned.

data MaintenancePaceSource #

Gaps between runs of each kind of work, and the bucket idle age. A zero gap runs that work every pass.

Constructors

MaintenancePace 

Fields

runReaperOp :: MonadArbiter m => LogConfig -> NominalDiffTime -> Text -> NominalDiffTime -> m a -> m (Maybe a)Source #

Arguments

:: MonadArbiter m 
=> LogConfig 
-> NominalDiffTime

Statement timeout

-> Text

Task name

-> NominalDiffTime

Gate window: minimum gap between runs across all callers

-> m a 
-> m (Maybe a) 

Run one gated maintenance operation. Nothing when it failed, is running elsewhere, or its window has not elapsed. Failures are logged.