Closed SdxCoder closed 2 months ago
@aallam Can we have a look into this issue. Also algolia helper flutter is not exposing any way to change read and write timeout. May be we can update the api like this
AlgoliaHitsSearchService({
required String applicationID,
required String apiKey,
Duration connectTimeout = const Duration(seconds: 2),
Duration writeTimeout = const Duration(seconds: 30),
Duration readTimeout = const Duration(seconds: 5),
}) : this.create(
algolia.SearchClient(
appId: applicationID,
apiKey: apiKey,
options: const algolia.ClientOptions(
connectTimeout : connectTimeout,
writeTimeout : writeTimeout,
readTimeout : readTimeout,
agentSegments: [
algolia.AgentSegment(
value: 'algolia-helper-flutter',
version: libVersion,
),
],
),
),
);
factory _HitsSearcher({
required String applicationID,
required String apiKey,
required SearchState state,
bool disjunctiveFacetingEnabled = true,
Duration debounce = const Duration(milliseconds: 100),
bool insights = false,
Duration connectTimeout = const Duration(seconds: 2),
Duration writeTimeout = const Duration(seconds: 30),
Duration readTimeout = const Duration(seconds: 5),
}) {
final service = AlgoliaHitsSearchService(
applicationID: applicationID,
apiKey: apiKey,
connectTimeout : connectTimeout,
writeTimeout : writeTimeout,
readTimeout : readTimeout,
);
and then further exposing it to HitSearcher
cc @aallam
We have another similar type but different exception. Please check this error log
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Exception: UnreachableHostsException{errors: [AlgoliaIOException{error: DioException [connection error]: The connection errored: Failed host lookup: '-dsn.algolia.net' This indicates an error which most likely cannot be solved by the library. Error: SocketException: Failed host lookup: '-dsn.algolia.net' (OS Error: No address associated with hostname, errno = 7)}, AlgoliaIOException{error: DioException [connection error]: The connection errored: Failed host lookup: '-3.algolianet.com' This indicates an error which most likely cannot be solved by the library. Error: SocketException: Failed host lookup: '-3.algolianet.com' (OS Error: No address associated with hostname, errno = 7)}, AlgoliaIOException{error: DioException [connection error]: The connection errored: Failed host lookup: '-2.algolianet.com' This indicates an error which most likely cannot be solved by the library. Error: SocketException: Failed host lookup: '-2.algolianet.com' (OS Error: No address associated with hostname, errno = 7)}, AlgoliaIOException{error: DioException [connection error]: The connection errored: Failed host lookup: '-1.algolianet.com' This indicates an error which most likely cannot be solved by the library. Error: SocketException: Failed host lookup: '-1.algolianet.com' (OS Error: No address associated with hostname, errno = 7)}]} at AlgoliaHitsSearchService._disjunctiveSearch(algolia_hits_search_service.dart:94)
@aallam We are failing host lookup here. Can you please help, any solution for these errors?
It is problem with the core package. The timeout duration is only 2 sec by default.
Hi, we just published algolia_helper_flutter v1.1.0, which lets you customize client options from HitsSearcher.
@dhayab these client options don't expose interceptor.
Describe the bug π
From time to time we are facing this AlgoliaTimeoutException.
To Reproduce π
No clear steps to reproduce
Expected behavior π
Connection timeout shouldn't be thrown.
Screenshots π₯
SC
Environment:
Additional context
Error Log
#### Crashlytics - Stack trace #### Application: com.alhabibpharmacy.staging #### Platform: android #### Version: 1.0.193 (194) #### Issue: 01b5f1c27da7a2f1b52fd2c2d9bb02f2 #### Session: 65EEEA050020000105663FA47CE60191_DNE_7_v2 #### Date: Mon Mar 11 2024 05:50:08 GMT-0600 (Mountain Daylight Time) Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Exception: UnreachableHostsException{errors: [AlgoliaTimeoutException{error: DioException [connection timeout]: The request connection took longer than 0:00:02.000000 and it was aborted. To get rid of this exception, try raising the RequestOptions.connectTimeout above the duration of 0:00:02.000000 or improve the response time of the server.}, AlgoliaTimeoutException{error: DioException [connection timeout]: The request connection took longer than 0:00:02.000000 and it was aborted. To get rid of this exception, try raising the RequestOptions.connectTimeout above the duration of 0:00:02.000000 or improve the response time of the server.}, AlgoliaTimeoutException{error: DioException [connection timeout]: The request connection took longer than 0:00:02.000000 and it was aborted. To get rid of this exception, try raising the RequestOptions.connectTimeout above the duration of 0:00:02.000000 or improve the response time of the server.}, AlgoliaTimeoutException{error: DioException [connection timeout]: The request connection took longer than 0:00:02.000000 and it was aborted. To get rid of this exception, try raising the RequestOptions.connectTimeout above the duration of 0:00:02.000000 or improve the response time of the server.}]} at AlgoliaHitsSearchService._disjunctiveSearch(algolia_hits_search_service.dart:94)