Skip to content

Commit

Permalink
fix: forward elasticsearch timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemDoum committed Aug 7, 2023
1 parent 3c99f35 commit f96aef8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions neo4j-app/neo4j_app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys
from configparser import ConfigParser
from logging.handlers import SysLogHandler
from typing import Dict, List, Optional, TextIO
from typing import Dict, List, Optional, TextIO, Union

import neo4j
from pydantic import Field, validator
Expand Down Expand Up @@ -37,7 +37,7 @@ class AppConfig(LowerCamelCaseModel, IgnoreExtraModel):
es_doc_type_field: str = Field(alias="docTypeField", default="type")
es_default_page_size: int = 1000
es_max_concurrency: int = 5
es_timeout: int = "1m"
es_timeout_s: Union[int, float] = 60 * 5
es_keep_alive: str = "1m"
neo4j_app_host: str = "127.0.0.1"
neo4j_app_log_level: str = "INFO"
Expand Down Expand Up @@ -142,14 +142,13 @@ def to_neo4j_driver(self) -> neo4j.AsyncDriver:
)
return driver

# TODO: change this to output ESClientMixin...
def to_es_client(self) -> ESClientABC:
client_cls = OSClient if self.neo4j_app_uses_opensearch else ESClient
# TODO: read the index name in a secure manner...
client = client_cls(
hosts=[self.elasticsearch_address],
pagination=self.es_default_page_size,
max_concurrency=self.es_max_concurrency,
timeout=self.es_timeout_s,
)
return client

Expand Down

0 comments on commit f96aef8

Please sign in to comment.