Document layered retry semantics (P2 documentation)
Add documentation to explain how transport-level and queue-level retries interact: - Email: MaxRetries (transport) * MaxAttempts (queue) = total SMTP attempts - Webhooks: RetryCount (transport) * MaxAttempts (queue) = total HTTP attempts - Example: 3 * 3 = 9 total delivery attempts for a single notification This clarifies the multiplicative retry behavior and helps operators understand the actual retry counts when using the persistent queue.
This commit is contained in:
parent
7ee11105f5
commit
b70dc3d00d
2 changed files with 10 additions and 0 deletions
|
|
@ -37,6 +37,11 @@ func NewEnhancedEmailManager(config EmailProviderConfig) *EnhancedEmailManager {
|
|||
}
|
||||
|
||||
// SendEmailWithRetry sends email with retry logic
|
||||
// Note: When used with the persistent queue, retry behavior is layered:
|
||||
// - Transport retries (this function): up to MaxRetries attempts with RetryDelay between
|
||||
// - Queue retries: up to MaxAttempts (default 3) with exponential backoff
|
||||
// Total attempts = MaxRetries * MaxAttempts (e.g., 3 * 3 = 9 SMTP calls for a single notification)
|
||||
// This ensures delivery even during transient failures at either layer.
|
||||
func (e *EnhancedEmailManager) SendEmailWithRetry(subject, htmlBody, textBody string) error {
|
||||
var lastErr error
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,11 @@ func (n *NotificationManager) shouldSendWebhook(webhook EnhancedWebhookConfig, a
|
|||
}
|
||||
|
||||
// sendWebhookWithRetry implements exponential backoff retry with enhanced error tracking
|
||||
// Note: When used with the persistent queue, retry behavior is layered:
|
||||
// - Transport retries (this function): up to RetryCount attempts with exponential backoff
|
||||
// - Queue retries: up to MaxAttempts (default 3) with exponential backoff
|
||||
// Total attempts = RetryCount * MaxAttempts (e.g., 3 * 3 = 9 HTTP calls for a single notification)
|
||||
// This ensures delivery even during transient failures at either layer.
|
||||
func (n *NotificationManager) sendWebhookWithRetry(webhook EnhancedWebhookConfig, payload []byte) error {
|
||||
maxRetries := webhook.RetryCount
|
||||
if maxRetries <= 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue