From 9b2b0ab8ae7e035bfbd96f83c53b53a979909086 Mon Sep 17 00:00:00 2001 From: davidtsuk <132949946+davidtsuk@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:09:40 -0700 Subject: [PATCH] Add a setting for batch_join_timeout (#6314) Closes #6306 --- 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