| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
IHP.Job.Queue.Result
Synopsis
- jobDidFail :: (Table job, HasField "id" job (Id' (GetTableName job)), PrimaryKey (GetTableName job) ~ UUID, HasField "attemptsCount" job Int, HasField "runAt" job UTCTime, Job job, ?context :: context, HasField "logger" context Logger) => Pool -> job -> SomeException -> IO ()
- jobDidTimeout :: (Table job, HasField "id" job (Id' (GetTableName job)), PrimaryKey (GetTableName job) ~ UUID, HasField "attemptsCount" job Int, HasField "runAt" job UTCTime, Job job, ?context :: context, HasField "logger" context Logger) => Pool -> job -> IO ()
- jobDidSucceed :: (Table job, HasField "id" job (Id' (GetTableName job)), PrimaryKey (GetTableName job) ~ UUID, ?context :: context, HasField "logger" context Logger) => Pool -> job -> IO ()
- backoffDelay :: BackoffStrategy -> Int -> NominalDiffTime
- recoverStaleJobs :: Table job => Pool -> NominalDiffTime -> IO ()
Documentation
jobDidFail :: (Table job, HasField "id" job (Id' (GetTableName job)), PrimaryKey (GetTableName job) ~ UUID, HasField "attemptsCount" job Int, HasField "runAt" job UTCTime, Job job, ?context :: context, HasField "logger" context Logger) => Pool -> job -> SomeException -> IO () Source #
Called when a job failed. Sets the job status to JobStatusFailed or JobStatusRetry (if more attempts are possible) and resets lockedBy
jobDidTimeout :: (Table job, HasField "id" job (Id' (GetTableName job)), PrimaryKey (GetTableName job) ~ UUID, HasField "attemptsCount" job Int, HasField "runAt" job UTCTime, Job job, ?context :: context, HasField "logger" context Logger) => Pool -> job -> IO () Source #
jobDidSucceed :: (Table job, HasField "id" job (Id' (GetTableName job)), PrimaryKey (GetTableName job) ~ UUID, ?context :: context, HasField "logger" context Logger) => Pool -> job -> IO () Source #
Called when a job succeeded. Sets the job status to JobStatusSucceded and resets lockedBy
backoffDelay :: BackoffStrategy -> Int -> NominalDiffTime Source #
Compute the delay before the next retry attempt.
For LinearBackoff, the delay is constant.
For ExponentialBackoff, the delay doubles each attempt, capped at 24 hours.
recoverStaleJobs :: Table job => Pool -> NominalDiffTime -> IO () Source #
Recover stale jobs that have been in JobStatusRunning for too long,
likely due to a worker crash.
Two-tier recovery: - Recently stale jobs (within 24h) are set back to retry - Ancient stale jobs (older than 24h) are marked as failed