Question

I have algolia integrated with magento 2 site , suddenly algolia is throwing error on product listing page and search page.

Error is about Server connection time out !

enter image description here

Was it helpful?

Solution

Finally I got the solution for this issue!! The issue was due to my server's slow connection with algolia server. Algolia search by default uses 1s connection timeout, which I increased to 10 seconds, solved my issue.

To change timeout to 10s we need to edit below file by overriding it:

\vendor\algolia\algoliasearch-client-php\src\AlgoliaSearch\ClientContext.php

  // connect timeout of 1s by default
    $this->connectTimeout = 10;

    // global timeout of 30s by default
    $this->readTimeout = 30;

    // search timeout of 5s by default
    $this->searchTimeout = 10;
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top