Skip to content

Commit 0891d0f

Browse files
[11.x] add withoutDelay() to PendingDispatch (#52696)
1 parent f9696a7 commit 0891d0f

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Illuminate/Foundation/Bus/PendingDispatch.php

+12
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ public function delay($delay)
100100
return $this;
101101
}
102102

103+
/**
104+
* Set the delay for the job to zero seconds.
105+
*
106+
* @return $this
107+
*/
108+
public function withoutDelay()
109+
{
110+
$this->job->withoutDelay();
111+
112+
return $this;
113+
}
114+
103115
/**
104116
* Indicate that the job should be dispatched after all database transactions have committed.
105117
*

tests/Queue/QueueDelayTest.php

+11
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ public function test_queue_without_delay()
3030

3131
$this->assertEquals(0, $job->delay);
3232
}
33+
34+
public function test_pending_dispatch_without_delay()
35+
{
36+
Queue::fake();
37+
38+
$job = new TestJob;
39+
40+
dispatch($job)->withoutDelay();
41+
42+
$this->assertEquals(0, $job->delay);
43+
}
3344
}
3445

3546
class TestJob implements ShouldQueue

0 commit comments

Comments
 (0)