ClickHouseResponse repeat(ClickHouseRequest<?> sealedRequest, ClickHouseException exception, long timeout) {
            if (timeout > 0L) {
                final int errorCode = exception.getErrorCode();
                final long startTime = System.currentTimeMillis();

                long delay = INITIAL_REPEAT_DELAY;
                long elapsed = 0L;
                int count = 1;
                while (true) {
                    log.info("Repeating #%d (delay=%d, elapsed=%d, timeout=%d) due to: %s", count++, delay, elapsed,
                            timeout, exception.getMessage());
                    try {
                        return sendOnce(sealedRequest);
                    } catch (Exception exp) {
                        exception = ClickHouseException.of(exp.getCause() != null ? exp.getCause() : exp,
                                sealedRequest.getServer());
                    }

                    elapsed = System.currentTimeMillis() - startTime;
                    if (exception.getErrorCode() != errorCode || elapsed + delay >= timeout) {
                        log.warn("Stopped repeating(delay=%d, elapsed=%d, timeout=%d) for %s", delay, elapsed,
                                timeout, exception.getMessage());
                        break;
                    }

                    try {
                        Thread.sleep(delay);
                        elapsed += delay;
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                        break;
                    }
                    if (delay >= MAX_REPEAT_DELAY) {
                        delay = MAX_REPEAT_DELAY;
                    } else {
                        delay += REPEAT_DELAY_BACKOFF;
                    }
                }
            }
            throw new CompletionException(exception);
        }
Repeats sending same request until success, timed out or running into a
different error.

@param sealedRequest non-null sealed request
@param exception     non-null exception to start with
@param timeout       timeout in milliseconds, zero or negative numbers means
                     no repeat
@return non-null response
@throws CompletionException when error occurred or timed out
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseClientBuilder.java