SIGN IN SIGN UP

Retry event-log inserts on transient ClickHouse network errors without Sentry noise (#24760)

## Problem

We log ~470 Sentry errors a day for ClickHouse insert timeouts
(TWENTY-SERVER-JSF). These are not server failures: the inserts that
time out never reach ClickHouse at all. The client occasionally writes a
request onto a keep-alive socket the load balancer just closed, then
waits 30s for a response that will never come. It affects ~0.02% of
inserts, and each hit permanently drops the event rows because the job
had no retry.

## Fix

Handled in the job, following the messaging import exception handler
pattern:

- `isTransientClickHouseNetworkError` recognizes stale-connection errors
(timeout, socket hang up, ECONNRESET and friends).
- On a transient error, `CreateEventLogFromInternalEvent` requeues the
batch once - the retry gets a fresh socket and succeeds. If the retry
fails the same way, the batch is dropped with a warning log. No Sentry
either way.
- Any other error still fails the job and reports to Sentry as before.
- `retryLimit: 1` on the event-log and timeline enqueues, which were the
only ones in the listener without retries.

Also renames `src/database/clickHouse` to `src/database/clickhouse` and
splits `clickHouse.util.ts` into one-function files under `utils/`.

## Expected result

TWENTY-SERVER-JSF drops to ~zero; real ClickHouse errors keep reporting.
C
Charles Bochet committed
d422be8da10d4c9edf854aa264f6fe39b4018844
Parent: 70b44ff
Committed by GitHub <noreply@github.com> on 8/25/2026, 2:46:52 PM