Skip to content

Commit

Permalink
add delay method to PendingChain (#34789)
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Oct 12, 2020
1 parent 6e5e36f commit e2d5038
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Illuminate/Foundation/Bus/PendingChain.php
Expand Up @@ -37,6 +37,13 @@ class PendingChain
*/
public $queue;

/**
* The number of seconds before the chain should be made available.
*
* @var \DateTimeInterface|\DateInterval|int|null
*/
public $delay;

/**
* The callbacks to be executed on failure.
*
Expand Down Expand Up @@ -83,6 +90,19 @@ public function onQueue($queue)
return $this;
}

/**
* Set the desired delay for the chain.
*
* @param \DateTimeInterface|\DateInterval|int|null $delay
* @return $this
*/
public function delay($delay)
{
$this->delay = $delay;

return $this;
}

/**
* Add a callback to be executed on job failure.
*
Expand Down Expand Up @@ -126,6 +146,7 @@ public function dispatch()
$firstJob->allOnConnection($this->connection);
$firstJob->allOnQueue($this->queue);
$firstJob->chain($this->chain);
$firstJob->delay($this->delay);
$firstJob->chainCatchCallbacks = $this->catchCallbacks();

return app(Dispatcher::class)->dispatch($firstJob);
Expand Down

0 comments on commit e2d5038

Please sign in to comment.