Allow clean route feedback to clear stale fences

This commit is contained in:
2026-05-15 20:49:24 +03:00
parent 3344fe5020
commit 54ce203c67
@@ -2130,6 +2130,13 @@ func (s *PostgresStore) RecordFabricServiceChannelRouteFeedback(ctx context.Cont
EXCLUDED.feedback_status = 'healthy'
AND fabric_service_channel_route_feedback_latest.feedback_status IN ('degraded', 'fenced')
AND fabric_service_channel_route_feedback_latest.expires_at > EXCLUDED.observed_at
AND NOT (
EXCLUDED.consecutive_failures = 0
AND EXCLUDED.stall_count = 0
AND COALESCE(NULLIF(EXCLUDED.payload->>'quality_window_failure_count', '')::int, 0) = 0
AND COALESCE(NULLIF(EXCLUDED.payload->>'quality_window_drop_count', '')::int, 0) = 0
AND COALESCE(NULLIF(EXCLUDED.payload->>'quality_window_slow_count', '')::int, 0) = 0
)
)
`, item.ClusterID, item.ReporterNodeID, item.RouteID, item.ID, item.ServiceClass, item.FeedbackStatus, item.ScoreAdjustment,
item.Reasons, item.LastError, item.ConsecutiveFailures, item.StallCount, item.LastSendDurationMs, []byte(item.Payload), item.ObservedAt, item.ExpiresAt); err != nil {