Throttle the number of times a project's "last_repository_updated_at" column can be updated
Whenver you create a push event we end up updating the last_repository_updated_at
column of a project. In https://gitlab.com/gitlab-org/gitlab-ce/issues/35363 I mentioned moving this column (and another one) to a separate table, but we should also throttle updates. This prevents one from negatively impacting the database by just pushing a lot of commits in sequence.
A simple start would be to limit the number of updates to once per 5 minutes per project using a ExclusiveLease, similar to Event#reset_project_activity
. This ensures the column is still accurate enough while at the same time giving us a bit more control over the number of updates.
Edited by Yorick Peterse