From 1ca8ae466b3e1060ba1dfb9eef97f8d5341286fb Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 14 Feb 2022 11:21:24 -0800 Subject: increase ES default timeout to 50sec, and _health specifically to 90sec This is because we are getting lots of alert chunder on the health check. It might be better to revisit which endpoint is being checked... 'count' is usually fast, but might be slow during bulk indexing. --- fatcat_scholar/search.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index bb0b155..5cf916c 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -100,7 +100,7 @@ class FulltextHits(BaseModel): # global sync client connection -es_client = elasticsearch.Elasticsearch(settings.ELASTICSEARCH_QUERY_BASE, timeout=40.0) +es_client = elasticsearch.Elasticsearch(settings.ELASTICSEARCH_QUERY_BASE, timeout=50.0) def transform_es_results(resp: Response) -> List[dict]: @@ -464,7 +464,9 @@ def es_scholar_index_alive() -> bool: """ try: resp = es_client.count( - body=None, index=settings.ELASTICSEARCH_QUERY_FULLTEXT_INDEX + body=None, + index=settings.ELASTICSEARCH_QUERY_FULLTEXT_INDEX, + timeout=90.0, ) except elasticsearch.exceptions.RequestError as e_raw: if e_raw.status_code == 404: -- cgit v1.2.3