-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow configuration of key parameters for the queue (#5)
* feat: allow configuration of key parameters for the queue * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot <[email protected]>
- Loading branch information
1 parent
61bf2a7
commit c90fc0f
Showing
3 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of blomstra/database-queue | ||
* | ||
* Copyright (c) 2023 Blomstra Ltd. | ||
* | ||
* For the full copyright and license information, please view the LICENSE.md | ||
* file that was distributed with this source code. | ||
* | ||
*/ | ||
|
||
namespace Blomstra\DatabaseQueue\Console; | ||
|
||
use Flarum\Settings\SettingsRepositoryInterface; | ||
|
||
class WorkerArgs | ||
{ | ||
/** | ||
* @var SettingsRepositoryInterface | ||
*/ | ||
protected $settings; | ||
|
||
public function __construct(SettingsRepositoryInterface $settings) | ||
{ | ||
$this->settings = $settings; | ||
} | ||
|
||
public function args(): array | ||
{ | ||
$args = [ | ||
'--stop-when-empty', | ||
]; | ||
|
||
$args['--tries'] = $this->settings->get('blomstra-database-queue.retries'); | ||
$args['--timeout'] = $this->settings->get('blomstra-database-queue.timeout'); | ||
$args['--rest'] = $this->settings->get('blomstra-database-queue.rest'); | ||
$args['--memory'] = $this->settings->get('blomstra-database-queue.memory'); | ||
$args['--backoff'] = $this->settings->get('blomstra-database-queue.backoff'); | ||
|
||
return $args; | ||
} | ||
} |