Safe Haskell | Safe-Inferred |
---|
IHP.Job.Types
Synopsis
- class Job job where
- perform :: (?modelContext :: ModelContext, ?context :: FrameworkConfig) => job -> IO ()
- maxAttempts :: (?job :: job) => Int
- timeoutInMicroseconds :: (?job :: job) => Maybe Int
- queuePollInterval :: Int
- maxConcurrency :: Int
- 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
Documentation
Minimal complete definition
Methods
perform :: (?modelContext :: ModelContext, ?context :: FrameworkConfig) => job -> IO () Source #
maxAttempts :: (?job :: job) => Int Source #
timeoutInMicroseconds :: (?job :: job) => 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 |