File tree Expand file tree Collapse file tree 4 files changed +48
-4
lines changed Expand file tree Collapse file tree 4 files changed +48
-4
lines changed Original file line number Diff line number Diff line change 6
6
use Algolia \AlgoliaSearch \Response \AbstractResponse ;
7
7
use Algolia \AlgoliaSearch \Response \BatchIndexingResponse ;
8
8
use Algolia \AlgoliaSearch \Response \MultiResponse ;
9
+ use Algolia \AlgoliaSearch \Config \SearchConfig ;
9
10
use Algolia \AlgoliaSearch \SearchClient ;
10
11
use Algolia \AlgoliaSearch \SearchIndex ;
11
12
use Algolia \AlgoliaSearch \Support \UserAgent ;
@@ -89,10 +90,11 @@ public function getRequest()
89
90
public function resetCredentialsFromConfig ()
90
91
{
91
92
if ($ this ->config ->getApplicationID () && $ this ->config ->getAPIKey ()) {
92
- $ this ->client = SearchClient::create (
93
- $ this ->config ->getApplicationID (),
94
- $ this ->config ->getAPIKey ()
95
- );
93
+ $ config = SearchConfig::create ($ this ->config ->getApplicationID (), $ this ->config ->getAPIKey ());
94
+ $ config ->setConnectTimeout ($ this ->config ->getConnectionTimeout ());
95
+ $ config ->setReadTimeout ($ this ->config ->getReadTimeout ());
96
+ $ config ->setWriteTimeout ($ this ->config ->getWriteTimeout ());
97
+ $ this ->client = SearchClient::createWithConfig ($ config );
96
98
}
97
99
}
98
100
Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ class ConfigHelper
100
100
'algoliasearch_advanced/advanced/backend_rendering_allowed_user_agents ' ;
101
101
public const NON_CASTABLE_ATTRIBUTES = 'algoliasearch_advanced/advanced/non_castable_attributes ' ;
102
102
public const MAX_RECORD_SIZE_LIMIT = 'algoliasearch_advanced/advanced/max_record_size_limit ' ;
103
+ public const CONNECTION_TIMEOUT = 'algoliasearch_advanced/advanced/connection_timeout ' ;
104
+ public const READ_TIMEOUT = 'algoliasearch_advanced/advanced/read_timeout ' ;
105
+ public const WRITE_TIMEOUT = 'algoliasearch_advanced/advanced/write_timeout ' ;
103
106
104
107
public const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock ' ;
105
108
@@ -1174,6 +1177,33 @@ public function getIndexPrefix($storeId = null)
1174
1177
return $ this ->configInterface ->getValue (self ::INDEX_PREFIX , ScopeInterface::SCOPE_STORE , $ storeId );
1175
1178
}
1176
1179
1180
+ /**
1181
+ * @param $storeId
1182
+ * @return mixed'
1183
+ */
1184
+ public function getConnectionTimeout ($ storeId = null )
1185
+ {
1186
+ return $ this ->configInterface ->getValue (self ::CONNECTION_TIMEOUT , ScopeInterface::SCOPE_STORE , $ storeId );
1187
+ }
1188
+
1189
+ /**
1190
+ * @param $storeId
1191
+ * @return mixed'
1192
+ */
1193
+ public function getReadTimeout ($ storeId = null )
1194
+ {
1195
+ return $ this ->configInterface ->getValue (self ::READ_TIMEOUT , ScopeInterface::SCOPE_STORE , $ storeId );
1196
+ }
1197
+
1198
+ /**
1199
+ * @param $storeId
1200
+ * @return mixed'
1201
+ */
1202
+ public function getWriteTimeout ($ storeId = null )
1203
+ {
1204
+ return $ this ->configInterface ->getValue (self ::WRITE_TIMEOUT , ScopeInterface::SCOPE_STORE , $ storeId );
1205
+ }
1206
+
1177
1207
/**
1178
1208
* @param $storeId
1179
1209
* @return array|bool|float|int|mixed|string
Original file line number Diff line number Diff line change 1259
1259
If your Algolia plan allows a higher record size limit, you can customize the record size limit.]]>
1260
1260
</comment >
1261
1261
</field >
1262
+ <field id =" connection_timeout" translate =" label comment" type =" text" sortOrder =" 100" showInDefault =" 1" >
1263
+ <label >Connection Timeout (In Seconds)</label >
1264
+ </field >
1265
+ <field id =" read_timeout" translate =" label comment" type =" text" sortOrder =" 105" showInDefault =" 1" >
1266
+ <label >Read Timeout (In Seconds)</label >
1267
+ </field >
1268
+ <field id =" write_timeout" translate =" label comment" type =" text" sortOrder =" 110" showInDefault =" 1" >
1269
+ <label >Write Timeout (In Seconds)</label >
1270
+ </field >
1262
1271
</group >
1263
1272
<group id =" queue" translate =" label" type =" text" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
1264
1273
<label >Indexing Queue</label >
Original file line number Diff line number Diff line change 81
81
<algoliasearch_advanced >
82
82
<advanced >
83
83
<max_record_size_limit >10000</max_record_size_limit >
84
+ <connection_timeout >2</connection_timeout >
85
+ <read_timeout >30</read_timeout >
86
+ <write_timeout >30</write_timeout >
84
87
</advanced >
85
88
<queue >
86
89
<number_of_element_by_page >300</number_of_element_by_page >
You can’t perform that action at this time.
0 commit comments