Skip to content

Commit

Permalink
feat: add timeout options for algolia client (#501)
Browse files Browse the repository at this point in the history
* feat: add timeout options for algolia client

* formatting

Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
  • Loading branch information
hareku and taylorotwell authored Jul 26, 2021
1 parent 89d7a85 commit 167752d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/EngineManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ public function createAlgoliaDriver()
$this->defaultAlgoliaHeaders()
);

if (is_int($connectTimeout = config('scout.algolia.connect_timeout'))) {
$config->setConnectTimeout($connectTimeout);
}

if (is_int($readTimeout = config('scout.algolia.read_timeout'))) {
$config->setReadTimeout($readTimeout);
}

if (is_int($writeTimeout = config('scout.algolia.write_timeout'))) {
$config->setWriteTimeout($writeTimeout);
}

return new AlgoliaEngine(Algolia::createWithConfig($config), config('scout.soft_delete'));
}

Expand Down

0 comments on commit 167752d

Please sign in to comment.