Skip to content

Commit

Permalink
chore: continue on timeout for CH lightweight deletes (#25319)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech authored Oct 1, 2024
1 parent 201f8ed commit c31db01
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions posthog/models/async_deletion/delete_events.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any

from clickhouse_driver.errors import SocketTimeoutError
from prometheus_client import Counter

from posthog.client import sync_execute
Expand Down Expand Up @@ -69,11 +70,18 @@ def process(self, deletions: list[AsyncDeletion]):
# If the query size is greater than the max predicate size, execute the query and reset the query predicate
if query_size > MAX_QUERY_SIZE:
logger.debug(f"Executing query with args: {args}")
sync_execute(
query,
args,
settings={},
)
try:
sync_execute(
query,
args,
settings={},
)
except SocketTimeoutError:
# This is unfortunately needed because currently all lightweight deletes are executed sync
logger.warning(
"ClickHouse query timed out during async deletion. This is expected. Continuing with next batch.",
exc_info=True,
)

conditions, args = [], {}

Expand Down

0 comments on commit c31db01

Please sign in to comment.