Skip to content

Commit

Permalink
Ability to config queue connection for UpdateCollectionEntryOrder job (
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasbohman authored Oct 10, 2023
1 parent 00ff411 commit efaa724
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/eloquent-driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Collections\CollectionModel::class,
'update_entry_order_queue' => 'default',
'update_entry_order_connection' => 'default',
],

'collection_trees' => [
Expand Down
11 changes: 9 additions & 2 deletions src/Collections/CollectionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ public function updateEntryOrder(CollectionContract $collection, $ids = null)
$collection->queryEntries()
->get(['id'])
->each(function ($entry) {
UpdateCollectionEntryOrder::dispatch($entry->id())
->onQueue(config('statamic.eloquent-driver.collections.update_entry_order_queue', 'default'));
$dispatch = UpdateCollectionEntryOrder::dispatch($entry->id());

$connection = config('statamic.eloquent-driver.collections.update_entry_order_connection', 'default');

if ($connection != 'default') {
$dispatch->onConnection($connection);
}

$dispatch->onQueue(config('statamic.eloquent-driver.collections.update_entry_order_queue', 'default'));
});
}
}

0 comments on commit efaa724

Please sign in to comment.