Repository navigation
Sender: configurable DB pool, honest concurrency, one probe for a down domain - #56
Merged
Merged
Conversation
…n domain A delivery holds one connection from the sender's database pool for its whole exchange, so the pool, fixed at 32, was the real limit on outbound deliveries whatever FMSG_MAX_CONCURRENT_SEND said, and a backlog for an unreachable domain could hold every connection for a connect timeout at a time while deliveries to healthy domains waited. - FMSG_SENDER_DB_MAX_CONNS sets the pool size (default 32, minimum 2). - The delivery semaphore is sized to what can actually run: the smaller of FMSG_MAX_CONCURRENT_SEND and the pool minus one connection kept for the query that finds pending work. Deliveries no longer queue for a connection while holding a slot, and the start-up log states the number. - A domain the sender could not resolve or connect to gets one delivery at a time until a connection to it succeeds. The rest of its backlog waits for a later poll instead of occupying delivery slots. Part of #55; deliveries still hold a connection across network I/O. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Summary
Part of #55.
A delivery holds one connection from the sender's database pool for its whole exchange. The pool was fixed at 32, so that was the real limit on outbound deliveries whatever
FMSG_MAX_CONCURRENT_SENDsaid, and a backlog for an unreachable domain could hold every connection for a connect timeout at a time while deliveries to healthy domains waited.FMSG_SENDER_DB_MAX_CONNSsets the sender pool size (default 32, minimum 2).FMSG_MAX_CONCURRENT_SENDand the pool size minus one connection kept for the query that finds pending work. Deliveries no longer queue for a connection while holding a slot, and the start-up log line states the number.Defaults: with nothing configured, 31 deliveries run at once (it was 32, with the poll query competing for the same connections).
Not changed: deliveries still hold a connection across network I/O (the second option in #55), and the first burst to a domain that has just gone down can still take every slot until its first connect fails.
Testing
cmd/fmsgd/sender_dispatch_test.go: the slot calculation, target de-duplication, and the one-at-a-time rule for an unreachable domain including recovery.go vet ./...andgo test -race ./...pass.🤖 Generated with Claude Code