Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forward elasticsearch timeout #69

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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