From 167752d6f8e7a1d4d5a8415c44b60371e9324779 Mon Sep 17 00:00:00 2001 From: hareku Date: Mon, 26 Jul 2021 22:16:01 +0900 Subject: [PATCH] feat: add timeout options for algolia client (#501) * feat: add timeout options for algolia client * formatting Co-authored-by: Taylor Otwell --- src/EngineManager.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/EngineManager.php b/src/EngineManager.php index 4e74186f..75c5136c 100644 --- a/src/EngineManager.php +++ b/src/EngineManager.php @@ -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')); }