Skip to content

Commit

Permalink
fix(api): add enriched events (keephq#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored Apr 9, 2024
1 parent ed73c21 commit e6fe172
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion keep/api/routes/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def handle_formatted_events(
raw_alert=raw_event,
)
session.add(alert)
enriched_formatted_events = []
for formatted_event in formatted_events:
formatted_event.pushed = True

Expand Down Expand Up @@ -549,6 +550,7 @@ def handle_formatted_events(
)
except Exception:
logger.exception("Failed to push alert to the client")
enriched_formatted_events.append(alert_dto)
session.commit()
logger.info(
"Asyncronusly added new alerts to the DB",
Expand All @@ -575,7 +577,7 @@ def handle_formatted_events(
workflow_manager = WorkflowManager.get_instance()
# insert the events to the workflow manager process queue
logger.info("Adding events to the workflow manager queue")
workflow_manager.insert_events(tenant_id, formatted_events)
workflow_manager.insert_events(tenant_id, enriched_formatted_events)
logger.info("Added events to the workflow manager queue")
except Exception:
logger.exception(
Expand Down

0 comments on commit e6fe172

Please sign in to comment.