Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: limit the amount of unannounced events we announce (#4845)
## About the changes When the events table is large we might be doing a full table scan searching for unannounced events. We spotted it due to a performance alert and confirmed in AWS performance insights ![image](https://github.com/Unleash/unleash/assets/455064/8e815fa3-7a1b-4453-881a-98a148eae119) The proposal is to limit this operation to 500 events (rule of thumb) per round https://github.com/Unleash/unleash/blob/f82ae354ebe6d3b0a3ddf15a051d6c8ed995c10e/src/lib/services/index.ts#L141-L147 and also ignore the events older than a day (because it seems reasonable) ## Discussion points **Idea**: split the `events` table into `recent_events` and `historical_events`. Recent can be anything from a day/week/month. This would help with recurrent queries that rely on recent data from the event's table such as optimal 304 calculation or event this scheduled task that sends unannounced events.
- Loading branch information