Safe Haskell | None |
---|
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
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 #
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');
JobStatusNotStarted | |
JobStatusRunning | |
JobStatusFailed | |
JobStatusTimedOut | |
JobStatusSucceeded | |
JobStatusRetry |
Instances
Enum JobStatus Source # | |
Defined in IHP.Job.Types succ :: JobStatus -> JobStatus # pred :: JobStatus -> JobStatus # fromEnum :: JobStatus -> Int # enumFrom :: JobStatus -> [JobStatus] # enumFromThen :: JobStatus -> JobStatus -> [JobStatus] # enumFromTo :: JobStatus -> JobStatus -> [JobStatus] # enumFromThenTo :: JobStatus -> JobStatus -> JobStatus -> [JobStatus] # | |
Read JobStatus Source # | |
Defined in IHP.Job.Types | |
Show JobStatus Source # | |
Default JobStatus Source # | |
Defined in IHP.Job.Queue | |
Eq JobStatus Source # | |
ParamReader JobStatus Source # | |
Defined in IHP.Job.Queue | |
InputValue JobStatus Source # | |
Defined in IHP.Job.Queue inputValue :: JobStatus -> Text Source # | |
FromField JobStatus | Mapping for CREATE TYPE JOB_STATUS AS ENUM ('job_status_not_started', 'job_status_running', 'job_status_failed', 'job_status_succeeded', 'job_status_retry'); |
Defined in IHP.Job.Queue | |
ToField JobStatus | Mapping for CREATE TYPE JOB_STATUS AS ENUM ('job_status_not_started', 'job_status_running', 'job_status_failed', 'job_status_succeeded', 'job_status_retry'); |
Defined in IHP.Job.Queue |
data JobWorkerProcess Source #
JobWorkerProcess | |
|
data BackoffStrategy Source #
Instances
Show BackoffStrategy Source # | |
Defined in IHP.Job.Types showsPrec :: Int -> BackoffStrategy -> ShowS # show :: BackoffStrategy -> String showList :: [BackoffStrategy] -> ShowS # | |
Eq BackoffStrategy Source # | |
Defined in IHP.Job.Types (==) :: BackoffStrategy -> BackoffStrategy -> Bool # (/=) :: BackoffStrategy -> BackoffStrategy -> Bool # |