Do not use AuditEvent.all

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

@mayra-cabrera has noted currently on GitLab.com we have several (millions) records on audit_table:

Even though the result is paginated, the call to AuditEvent.all is something that we should avoid because it fetches the entire table in a single pass, builds a model object per row, and then keeps the entire array of model objects in memory, all of those operations are expensive (performance-wise).

!27785 (comment 318759533)

Improvements

Risks

Involved components

Optional: Intended side effects

Optional: Missing test coverage

Edited by 🤖 GitLab Bot 🤖