Skip to content

Commit

Permalink
[11.x] add withoutDelay() to PendingDispatch (#52696)
Browse files Browse the repository at this point in the history
  • Loading branch information
KennedyTedesco authored Sep 9, 2024
1 parent f9696a7 commit 0891d0f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Illuminate/Foundation/Bus/PendingDispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public function delay($delay)
return $this;
}

/**
* Set the delay for the job to zero seconds.
*
* @return $this
*/
public function withoutDelay()
{
$this->job->withoutDelay();

return $this;
}

/**
* Indicate that the job should be dispatched after all database transactions have committed.
*
Expand Down
11 changes: 11 additions & 0 deletions tests/Queue/QueueDelayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ public function test_queue_without_delay()

$this->assertEquals(0, $job->delay);
}

public function test_pending_dispatch_without_delay()
{
Queue::fake();

$job = new TestJob;

dispatch($job)->withoutDelay();

$this->assertEquals(0, $job->delay);
}
}

class TestJob implements ShouldQueue
Expand Down

0 comments on commit 0891d0f

Please sign in to comment.