Skip to content

Commit 292f852

Browse files
committed
queueTimeout config moved to Config/Storage::class with nullable logic
1 parent e32007f commit 292f852

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/Console/Commands/ImportCommand.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Illuminate\Console\Command;
88
use Illuminate\Support\Collection;
9+
use Matchish\ScoutElasticSearch\ElasticSearch\Config\Config;
910
use Matchish\ScoutElasticSearch\Jobs\Import;
1011
use Matchish\ScoutElasticSearch\Jobs\QueueableJob;
1112
use Matchish\ScoutElasticSearch\Searchable\ImportSource;
@@ -48,11 +49,11 @@ private function import(string $searchable): void
4849
$sourceFactory = app(ImportSourceFactory::class);
4950
$source = $sourceFactory::from($searchable);
5051
$job = new Import($source);
51-
$job->timeout = config('elasticsearch.queue.timeout');
52+
$job->timeout = Config::queueTimeout();
5253

5354
if (config('scout.queue')) {
5455
$job = (new QueueableJob())->chain([$job]);
55-
$job->timeout = config('elasticsearch.queue.timeout');
56+
$job->timeout = Config::queueTimeout();
5657
}
5758

5859
$bar = (new ProgressBarFactory($this->output))->create();

src/ElasticSearch/Config/Config.php

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @method static password()
99
* @method static elasticCloudId()
1010
* @method static apiKey()
11+
* @method static queueTimeout()
1112
*/
1213
class Config
1314
{

src/ElasticSearch/Config/Storage.php

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ public function apiKey(): ?string
6363
return $this->loadConfig('api_key');
6464
}
6565

66+
/**
67+
* @return ?int
68+
*/
69+
public function queueTimeout(): ?int
70+
{
71+
return (int) $this->loadConfig('queue.timeout') ?: null;
72+
}
73+
6674
/**
6775
* @param string $path
6876
* @return mixed

0 commit comments

Comments
 (0)