Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] add withoutDelay() to PendingDispatch #52696

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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