Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 50a9491

Browse filesBrowse files
hansnntaylorotwell
andauthored
[11.x] Consider after_commit config in SyncQueue (#51071)
* Consider after_commit config in SyncQueue AfterCommit support was added to the SyncQueue in #48860. However, it only works if the job in question implements the ShouldQueueAfterCommit interface or sets the afterCommit property - it does not work if after_commit is set to true in the sync driver's configuration. This makes the behavior inconsistent, which is what this commit solves by also considering the after_commit config. * Update SyncQueue.php * Update SyncQueue.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 645f57a commit 50a9491
Copy full SHA for 50a9491

File tree

Expand file treeCollapse file tree

2 files changed

+12
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-1
lines changed

‎src/Illuminate/Queue/Connectors/SyncConnector.php

Copy file name to clipboardExpand all lines: src/Illuminate/Queue/Connectors/SyncConnector.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class SyncConnector implements ConnectorInterface
1414
*/
1515
public function connect(array $config)
1616
{
17-
return new SyncQueue;
17+
return new SyncQueue($config['after_commit'] ?? null);
1818
}
1919
}

‎src/Illuminate/Queue/SyncQueue.php

Copy file name to clipboardExpand all lines: src/Illuminate/Queue/SyncQueue.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@
1212

1313
class SyncQueue extends Queue implements QueueContract
1414
{
15+
/**
16+
* Create a new sync queue instance.
17+
*
18+
* @param bool $dispatchAfterCommit
19+
* @return void
20+
*/
21+
public function __construct($dispatchAfterCommit = false)
22+
{
23+
$this->dispatchAfterCommit = $dispatchAfterCommit;
24+
}
25+
1526
/**
1627
* Get the size of the queue.
1728
*

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.