[🐛 Bug]: dismiss 50 alerts (batch_enrich) takes 50sec
To Reproduce Steps to reproduce the behavior:
- Create workflows, which filters match the alerts.
- Go to Feed
- Select 50 alerts
- Click Dismiss
- See 50-130s request
Expected behavior Request return 200 immediately, related jobs continue in background.
Screenshots
The delay in dismissing 50 alerts using batch_enrich is likely due to the synchronous nature of the function, which processes all enrichments in a single transaction. To optimize this and return a 200 status immediately while continuing related jobs in the background, you can modify the batch_enrich function to perform the enrichment operations asynchronously.
The keep platform uses ARQ for handling asynchronous tasks. You can leverage ARQ to queue the enrichment process as a background task. This way, the main application can respond immediately, and the actual enrichment work is offloaded to a background worker.
Here's a conceptual approach:
- Immediate Response: Modify the API to return a 200 status immediately after queuing the task.
- Background Processing: Use ARQ to handle the enrichment process in the background.
This approach allows the UI to remain responsive while the enrichment tasks are processed asynchronously.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
is it a duplicate of https://github.com/keephq/keep/issues/3531?
is it a duplicate of #3531?
No, the #3531 is about the ability to select N alerts and change the status for all of them, not necessarily dismiss. I will update it's description
is it a duplicate of #3531?
No, the #3531 is about the ability to select N alerts and change the status for all of them, not necessarily dismiss. I will update it's description
Still sounds kinda the same thing, because "dismiss" is just another status, I guess (suppressed if i'm not mistaken) cc @shahargl