Throttle the number of UPDATEs triggered by touch
What does this MR do?
@_stark and I decided to pair on the issue ( https://gitlab.com/gitlab-org/gitlab-ce/issues/34763) that lead to this. He found the following graphs for the mentioned query: https://performance.gitlab.net/dashboard/db/postgres-single-query-drill-down?orgId=1&var-environment=prd&var-queryid=2989607667&var-fqdn=All
The changes in this MR throttle the number of UPDATE and SELECT queries that get triggered when calling
touch on Issue, MergeRequest, or Note objects to once per minute (per object). This should lead to a reduction in UPDATE queries on e.g.
merge_requests whenever a note is updated. We're using a one minute interval because this is small enough for people to most likely not notice it, while large enough to hopefully drastically reduce the number of updates.
See the commit (message) for more details.
Does this MR meet the acceptance criteria?
- Changelog entry added, if necessary
- Tests added for this feature/bug
- Has been reviewed by Backend
- Has been reviewed by Database
- Conform by the merge request performance guides
- Conform by the style guides
- Squashed related commits together
- Internationalization required/considered