Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit fff7c47

Browse files
Only send one server side event per request
We were sending one server side event per critical alert found. This should reduce the amount of server side events sent.
1 parent 5abdad6 commit fff7c47

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/codegate/db/connection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ async def record_alerts(self, alerts: List[Alert], initial_id: Optional[str]) ->
257257
recorded_alerts.append(alert_result)
258258
if alert_result and alert_result.trigger_category == "critical":
259259
await alert_queue.put(f"New alert detected: {alert.timestamp}")
260+
# break here to only alert once per request and not once per critical alert.
261+
break
260262
# Uncomment to debug the recorded alerts
261263
# logger.debug(f"Recorded alerts: {recorded_alerts}")
262264
return recorded_alerts

0 commit comments

Comments
 (0)