Repository navigation
Retry a client that fails on the database at start, instead of dropping it - #742
Merged
Merged
Conversation
abeldantas
requested review from
amaudruz and
christian-mcdermott
as code owners
October 9, 2026 11:45
amaudruz
approved these changes
Oct 9, 2026
abeldantas
force-pushed
the
fix/client-start-retry
branch
from
October 9, 2026 12:28
632c934 to
31a9bad
Compare
abeldantas
added a commit
that referenced
this pull request
Oct 9, 2026
abeldantas
force-pushed
the
fix/client-start-retry
branch
from
October 9, 2026 12:53
31a9bad to
b1fa6ec
Compare
…ng it At boot every client starts at once and asks for a connection in the same second. On the 9 Oct pilot restart that drained the pool: 13 clients timed out waiting for a connection and were dropped for good, so their agents connected but nothing on the server could post for them until the next restart. A database or network failure says nothing about the client, so it now waits (1 s, doubling, capped at 60 s) and tries again. Any other error still ends the client, as before.
…together The pool drained because every client asked for a connection in the same second. A deterministic backoff keeps that cohort synchronized: the 13 clients that timed out together would all retry at 1s, then 2s, then 4s, hitting the pool in the same waves that drained it. Each client now draws its delay uniformly from [0, cap], which spreads the cohort out. Claude-Session: https://claude.ai/code/session_01AbWGiYa9zvgoLevkdFwG6M
abeldantas
force-pushed
the
fix/client-start-retry
branch
from
October 9, 2026 13:02
b1fa6ec to
b068e39
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At boot every client starts at once, and each asks for a database connection, this drains the db the pool.
The cause is
_run_client: any exception fromconsumer.start()logged "crashed" and removed the client, and nothing ever started it again.Not in this PR: limiting how many clients start at once.
consumer.start()runs the client for its whole life, so a semaphore around it would cap how many clients exist. I will send that in a separate PR.