| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.InFlight
Description
Async-safe release for a claimed in-flight slot.
The metadata cache (Ecluse.Core.Server.Cache.Store) and the credential refresher (Ecluse.Core.Credential.Refresh.Internal) each collapse duplicate work onto one execution by claiming a slot. An asynchronous exception taken between the claim and the run that would free it wedges the slot: a follower parks forever and every caller behind it stalls until the process restarts. Both face that hazard, so the release discipline lives here once.
Synopsis
- guardInFlight :: (IO a -> IO a) -> (SomeException -> IO ()) -> IO () -> IO a -> IO a
Documentation
Arguments
| :: (IO a -> IO a) | The enclosing mask's |
| -> (SomeException -> IO ()) | Runs with the orphaning failure just before the release, to hand it to a waiting follower. A consumer whose waiters re-decide against the freed slot passes a no-op. |
| -> IO () | Free the claimed slot. Runs on every exit, asynchronous exceptions included. |
| -> IO a | The leader's run, executed under |
| -> IO a |
Run a leader's body and release its already-claimed in-flight slot on every exit. Call it
inside the mask that committed the claim, pass that mask's restore, and leave nothing interruptible between.