feat(events): add idempotent Kafka event consumer runtime

This commit is contained in:
shira committed 2026-10-06 03:59:57 +03:00
1 parent 565ef8d4f5
commit 3adb0ef9e4
47 files changed
+5018 -105

No files matched your search

@@ -13,6 +13,7 @@ import (
"github.com/google/uuid"
"lincodex/backend/internal/port/outbound"
"lincodex/backend/internal/worker/retry"
)
const (
@@ -136,7 +137,7 @@ func newTestRelay(store outbound.OutboxRelayStore, publisher outbound.EventPubli
return New(store, publisher, metrics, slog.New(slog.DiscardHandler), Settings{
BatchSize: 2,
PollInterval: testInterval,
Backoff: Backoff{Initial: testInterval, Max: 4 * testInterval},
Backoff: retry.Backoff{Initial: testInterval, Max: 4 * testInterval},
ShutdownTimeout: shutdownTimeout,
BacklogInterval: testInterval,
})
@@ -314,7 +315,7 @@ func TestRunStopsDuringBackoffWithoutAnotherPass(t *testing.T) {
}}, &countingMetrics{}, slog.New(slog.DiscardHandler), Settings{
BatchSize: 1,
PollInterval: testInterval,
Backoff: Backoff{Initial: time.Hour, Max: time.Hour},
Backoff: retry.Backoff{Initial: time.Hour, Max: time.Hour},
ShutdownTimeout: time.Second,
BacklogInterval: time.Hour,
})
@@ -337,7 +338,7 @@ func hourBackoffRelay(store outbound.OutboxRelayStore, publisher outbound.EventP
return New(store, publisher, &countingMetrics{}, slog.New(slog.DiscardHandler), Settings{
BatchSize: 2,
PollInterval: testInterval,
Backoff: Backoff{Initial: time.Hour, Max: time.Hour},
Backoff: retry.Backoff{Initial: time.Hour, Max: time.Hour},
ShutdownTimeout: time.Second,
BacklogInterval: backlogInterval,
})
@@ -409,7 +410,7 @@ func TestRunRefreshesTheBacklogAtMostOncePerInterval(t *testing.T) {
relay := New(store, fakePublisher{publish: acknowledgeAll}, metrics, slog.New(slog.DiscardHandler), Settings{
BatchSize: 1,
PollInterval: testInterval,
Backoff: Backoff{Initial: testInterval, Max: testInterval},
Backoff: retry.Backoff{Initial: testInterval, Max: testInterval},
ShutdownTimeout: time.Second,
BacklogInterval: time.Hour,
})