From a3b77951f0a6017b09060291f134c128ae5b6a60 Mon Sep 17 00:00:00 2001 From: Jonathan Moody <103143855+moodyjon@users.noreply.github.com> Date: Wed, 17 Aug 2022 16:57:08 -0400 Subject: [PATCH] Specify API-level search timeout to reduce hard timeout errors. --- hub/herald/search.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hub/herald/search.py b/hub/herald/search.py index d3b6b7f..0435bed 100644 --- a/hub/herald/search.py +++ b/hub/herald/search.py @@ -59,7 +59,7 @@ class SearchIndex: return False hosts = [{'host': self._elastic_host, 'port': self._elastic_port}] self.sync_client = AsyncElasticsearch(hosts, timeout=self.sync_timeout) - self.search_client = AsyncElasticsearch(hosts, timeout=self.search_timeout) + self.search_client = AsyncElasticsearch(hosts, timeout=self.search_timeout+1) while True: try: await self.sync_client.cluster.health(wait_for_status='yellow') @@ -207,6 +207,7 @@ class SearchIndex: query = expand_query(**kwargs) search_hits = deque((await self.search_client.search( query, index=self.index, track_total_hits=False, + timeout=f'{int(1000*self.search_timeout)}ms', _source_includes=['_id', 'channel_id', 'reposted_claim_id', 'creation_height'] ))['hits']['hits']) if remove_duplicates: