Safe Haskell | None |
---|
IHP.Job.Types
Synopsis
- class Job job where
- perform :: job -> IO ()
- maxAttempts :: Int
- timeoutInMicroseconds :: Maybe Int
- queuePollInterval :: Int
- maxConcurrency :: Int
- backoffStrategy :: BackoffStrategy
- data JobWorkerArgs = JobWorkerArgs {}
- newtype JobWorker = JobWorker (JobWorkerArgs -> IO JobWorkerProcess)
- data JobStatus
- class Worker application where
- data JobWorkerProcess = JobWorkerProcess {
- runners :: [Async ()]
- subscription :: Subscription
- poller :: Async ()
- action :: MVar JobWorkerProcessMessage
- data JobWorkerProcessMessage
- = JobAvailable
- | Stop
- data BackoffStrategy
- = LinearBackoff {
- delayInSeconds :: !Int
- | ExponentialBackoff {
- delayInSeconds :: !Int
- = LinearBackoff {
Documentation
Minimal complete definition
Methods
perform :: job -> IO () Source #
maxAttempts :: Int Source #
timeoutInMicroseconds :: Maybe Int Source #
queuePollInterval :: Int Source #
While jobs are typically fetch using pg_notiy, we have to poll the queue table
periodically to catch jobs with a run_at
in the future
By default we only poll every minute
maxConcurrency :: Int Source #
How many jobs of this type can be executed at the same time
This limit only applies to the running haskell process. If you run N
multiple
independent processes of the job runner, the limit will be N * maxConcurrency
data JobWorkerArgs Source #
Constructors
JobWorkerArgs | |
Fields |
Constructors
JobWorker (JobWorkerArgs -> IO JobWorkerProcess) |
Mapping for JOB_STATUS
. The DDL statement for this can be found in IHPSchema.sql:
CREATE TYPE JOB_STATUS AS ENUM ('job_status_not_started', 'job_status_running', 'job_status_failed', 'job_status_succeeded', 'job_status_retry');
Constructors
JobStatusNotStarted | |
JobStatusRunning | |
JobStatusFailed | |
JobStatusTimedOut | |
JobStatusSucceeded | |
JobStatusRetry |
Instances
data JobWorkerProcess Source #
Constructors
JobWorkerProcess | |
Fields
|
data JobWorkerProcessMessage Source #
Constructors
JobAvailable | |
Stop |
data BackoffStrategy Source #
Constructors
LinearBackoff | |
Fields
| |
ExponentialBackoff | |
Fields
|
Instances
Show BackoffStrategy Source # | |
Defined in IHP.Job.Types Methods showsPrec :: Int -> BackoffStrategy -> ShowS # show :: BackoffStrategy -> String showList :: [BackoffStrategy] -> ShowS # | |
Eq BackoffStrategy Source # | |
Defined in IHP.Job.Types Methods (==) :: BackoffStrategy -> BackoffStrategy -> Bool # (/=) :: BackoffStrategy -> BackoffStrategy -> Bool # |