QueueInterface
- Type
- Interface
- Namespace
- craft\queue
- Implemented by
- craft\queue\Queue
- Since
- 3.0.0
QueueInterface defines the common interface to be implemented by queue classes.
View source (opens new window)
# Public Methods
Method | Description |
---|---|
getHasReservedJobs() | Returns whether there are any reserved jobs. |
getHasWaitingJobs() | Returns whether there are any waiting jobs. |
getJobDetails() | Returns detailed info about a single job. |
getJobInfo() | Returns info about the jobs in the queue. |
getTotalJobs() | Returns the total number of jobs in the queue. |
release() | Releases a job from the queue. |
releaseAll() | Releases all jobs. |
retry() | Re-adds a failed job to the queue. |
retryAll() | Retries all failed jobs. |
run() | Runs all the queued-up jobs. |
setProgress() | Sets the progress for the currently reserved job. |
# getHasReservedJobs()
Returns whether there are any reserved jobs.
View source (opens new window)
Returns
# getHasWaitingJobs()
Returns whether there are any waiting jobs.
View source (opens new window)
Returns
# getJobDetails()
- Since
- 3.4.0
Returns detailed info about a single job.
The response array can contain the following keys:
delay
– the number of seconds remaining before the job will startstatus
– the job status (1 = waiting, 2 = reserved, 3 = done, 4 = failed)progress
– the job progress (0-100)progressLabel
– the progress label (lazy-translated with craft\i18n\Translation::translate())description
– the job description (lazy-translated with craft\i18n\Translation::translate())ttr
– the job’s time-to-reserve, in secondserror
– the error message (if the job failed)job
– the deserialized job
Any other key/value pairs are allowed and will be displayed on the details page.
View source (opens new window)
Arguments
Returns
Throws
- yii\base\InvalidArgumentException (opens new window)
if $id is an invalid job ID
# getJobInfo()
Returns info about the jobs in the queue.
The response array should have sub-arrays with the following keys:
id
– the job IDdelay
– the number of seconds remaining before the job will startstatus
– the job status (1 = waiting, 2 = reserved, 3 = done, 4 = failed)progress
– the job progress (0-100)progressLabel
– the progress label (lazy-translated with craft\i18n\Translation::translate())description
– the job description (lazy-translated with craft\i18n\Translation::translate())error
– the error message (if the job failed)
View source (opens new window)
Arguments
Returns
# getTotalJobs()
- Since
- 3.4.0
Returns the total number of jobs in the queue.
View source (opens new window)
Returns
# release()
Releases a job from the queue.
View source (opens new window)
Arguments
# releaseAll()
- Since
- 3.4.0
Releases all jobs.
View source (opens new window)
# retry()
Re-adds a failed job to the queue.
View source (opens new window)
Arguments
# retryAll()
- Since
- 3.4.0
Retries all failed jobs.
View source (opens new window)
# run()
Runs all the queued-up jobs.
View source (opens new window)
Returns
mixed
# setProgress()
Sets the progress for the currently reserved job.
View source (opens new window)
Arguments
$progress
(integer (opens new window)) – The job progress (1-100)$label
(string (opens new window), null (opens new window)) – The progress label