fix: scope realtime fanout dedup per node

This commit is contained in:
richjohnrambo
2026-09-14 20:15:22 +08:00
parent 6291fa2b60
commit 79babdb6aa
2 changed files with 22 additions and 1 deletions
@@ -191,6 +191,20 @@ func TestLoginTokenRevocation(t *testing.T) {
}
}
func TestRealtimeFanoutDedupClaimIDIsNodeScoped(t *testing.T) {
tenantID := types.TenantID(7)
dedupKey := "data:p2pABC:42"
nodeA := realtimeFanoutDedupClaimID(tenantID, "pod-a", dedupKey)
nodeB := realtimeFanoutDedupClaimID(tenantID, "pod-b", dedupKey)
if nodeA == nodeB {
t.Fatalf("dedup claim id must be node-scoped: %q", nodeA)
}
if got, want := realtimeFanoutDedupClaimID(tenantID, "", dedupKey), "7:local:data:p2pABC:42"; got != want {
t.Fatalf("unexpected local fallback claim id: got %q want %q", got, want)
}
}
func TestMessageRuntimeSeqAndClientMidIdempotency(t *testing.T) {
oldRuntime := groupMsgRuntime
runtime := newTestGroupMessageRuntime()