From 66514df540f19f76fa74987f0857b54a71e2970e Mon Sep 17 00:00:00 2001 From: David Tsukernik Date: Tue, 17 Sep 2024 08:55:28 -0700 Subject: [PATCH] Add a setting for batch_join_timeout --- snuba/clickhouse/http.py | 4 +++- snuba/settings/__init__.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/snuba/clickhouse/http.py b/snuba/clickhouse/http.py index 5c91105efe..9a1d35f89b 100644 --- a/snuba/clickhouse/http.py +++ b/snuba/clickhouse/http.py @@ -353,7 +353,9 @@ def write(self, values: Iterable[bytes]) -> None: batch.append(value) batch.close() - batch_join_timeout = state.get_config("http_batch_join_timeout", 10) + batch_join_timeout = state.get_config( + "http_batch_join_timeout", settings.BATCH_JOIN_TIMEOUT + ) # IMPORTANT: Please read the docstring of this method if you ever decide to remove the # timeout argument from the join method. batch.join(timeout=batch_join_timeout) diff --git a/snuba/settings/__init__.py b/snuba/settings/__init__.py index a9e0b298fb..f681b4dd99 100644 --- a/snuba/settings/__init__.py +++ b/snuba/settings/__init__.py @@ -242,6 +242,7 @@ class RedisClusters(TypedDict): DISCARD_OLD_EVENTS = True CLICKHOUSE_HTTP_CHUNK_SIZE = 8192 HTTP_WRITER_BUFFER_SIZE = 1 +BATCH_JOIN_TIMEOUT = os.environ.get("BATCH_JOIN_TIMEOUT", 10) # Retention related settings ENFORCE_RETENTION: bool = False