fix: per-call attempt counter so concurrent sends don't corrupt attempts
the attempt count used instance state (self._attempt_no), reset in _send_loop and incremented in _attempt; two concurrent send() calls on one Webhook interleaved, corrupting each other's WebhookResult.attempts. it is now a per-call mutable cell created in _send_loop and threaded into _attempt. verified under load: 400 concurrent sends, zero corrupted counts. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -48,7 +48,9 @@ Webhook(
|
||||
```
|
||||
|
||||
Inject a shared `session` for throughput (one session per process); without one, each
|
||||
send opens and closes its own.
|
||||
send opens and closes its own. A single `Webhook` instance is safe to drive from many
|
||||
concurrent `send()` calls — each call tracks its own attempt count, so concurrent sends
|
||||
don't corrupt each other's `WebhookResult.attempts`.
|
||||
|
||||
## WebhookResult
|
||||
|
||||
|
||||
Reference in New Issue
Block a user