/** @var int Maximum number of times to try a job */
protected $maxTries;
+ /** @var bool Allow delayed jobs */
+ protected $checkDelay;
+
/** @var BagOStuff */
protected $dupCache;
/** @var JobQueueAggregator */
if ( !in_array( $this->order, $this->supportedOrders() ) ) {
throw new MWException( __CLASS__ . " does not support '{$this->order}' order." );
}
+ $this->checkDelay = !empty( $params['checkDelay'] );
+ if ( $this->checkDelay && !$this->supportsDelayedJobs() ) {
+ throw new MWException( __CLASS__ . " does not support delayed jobs." );
+ }
$this->dupCache = wfGetCache( CACHE_ANYTHING );
$this->aggr = isset( $params['aggregator'] )
? $params['aggregator']
* but not acknowledged as completed after this many seconds. Recycling
* of jobs simple means re-inserting them into the queue. Jobs can be
* attempted up to three times before being discarded.
+ * - checkDelay : If supported, respect Job::getReleaseTimestamp() in the push functions.
+ * This lets delayed jobs wait in a staging area until a given timestamp is
+ * reached, at which point they will enter the queue. If this is not enabled
+ * or not supported, an exception will be thrown on delayed job insertion.
*
* Queue classes should throw an exception if they do not support the options given.
*
return $this->order;
}
+ /**
+ * @return bool Whether delayed jobs are enabled
+ * @since 1.22
+ */
+ final public function delayedJobsEnabled() {
+ return $this->checkDelay;
+ }
+
/**
* Get the allowed queue orders for configuration validation
*
if ( $job->getType() !== $this->type ) {
throw new MWException(
"Got '{$job->getType()}' job; expected a '{$this->type}' job." );
- } elseif ( $job->getReleaseTimestamp() && !$this->supportsDelayedJobs() ) {
+ } elseif ( $job->getReleaseTimestamp() && !$this->checkDelay ) {
throw new MWException(
"Got delayed '{$job->getType()}' job; delays are not supported." );
}