Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- Relay recovery loop could not reclaim stuck messages after a pod restart because `DefaultWebhookExpiry` (30s) was shorter than `pendingIdleTimeout` (60s). Fixed by raising `DefaultWebhookExpiry` to 2 minutes and lowering `pendingIdleTimeout` to 30s, ensuring the recovery loop always has time to reclaim a stuck message before it expires.

## [0.2.13] - 2026-06-11

### Changed
Expand Down
6 changes: 4 additions & 2 deletions internal/relay/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ var (
)

const (
// DefaultWebhookExpiry is the default time after which a queued webhook expires
DefaultWebhookExpiry = 30 * time.Second
// DefaultWebhookExpiry is the default time after which a queued webhook expires.
// Must be greater than pendingIdleTimeout + defaultRecoveryInterval so that the
// recovery loop can reclaim stuck messages before they expire.
DefaultWebhookExpiry = 2 * time.Minute
)

// Webhook represents a webhook request to be delivered via relay
Expand Down
2 changes: 1 addition & 1 deletion internal/relay/redis_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (

// Recovery settings
defaultRecoveryInterval = 30 * time.Second // How often to check for stuck messages
pendingIdleTimeout = 60 * time.Second // How long a message can be pending before reclaim
pendingIdleTimeout = 30 * time.Second // How long a message can be pending before reclaim
maxDeliveryAttempts = 3 // Max retries before dead letter
)

Expand Down
6 changes: 3 additions & 3 deletions internal/relay/redis_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,9 +908,9 @@ func TestRedisManager_Deliver_SetsExpiry(t *testing.T) {
if webhook.ExpiresAt == 0 {
t.Error("expected ExpiresAt to be set")
}
// Should be about 30 seconds in the future
expectedMin := time.Now().Add(25 * time.Second).Unix()
expectedMax := time.Now().Add(35 * time.Second).Unix()
// Should be about 2 minutes in the future
expectedMin := time.Now().Add(115 * time.Second).Unix()
expectedMax := time.Now().Add(125 * time.Second).Unix()
if webhook.ExpiresAt < expectedMin || webhook.ExpiresAt > expectedMax {
t.Errorf("ExpiresAt %d not in expected range [%d, %d]", webhook.ExpiresAt, expectedMin, expectedMax)
}
Expand Down
Loading