From 6a915d6f2d462a376d8cecc062dd58e520339b5e Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Tue, 2 May 2017 22:52:14 +0200 Subject: Limit `update_tracked_fields` to write to database once/hour Every time a user logs in or out, the Trackable attributes are written to the database. This is causing a lot of load on the database, for data that isn't really critical. So to avoid the database being hammered, add a Gitlab::ExclusiveLease before writing trackable attributes to the database. This lease expires after an hour, so only when the attributes were written more than an hour ago, they can be written again. Otherwise they are ignored. --- changelogs/unreleased/tc-cache-trackable-attributes.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/tc-cache-trackable-attributes.yml (limited to 'changelogs') diff --git a/changelogs/unreleased/tc-cache-trackable-attributes.yml b/changelogs/unreleased/tc-cache-trackable-attributes.yml new file mode 100644 index 00000000000..4a2cf50893a --- /dev/null +++ b/changelogs/unreleased/tc-cache-trackable-attributes.yml @@ -0,0 +1,4 @@ +--- +title: "Limit User's trackable attributes, like `current_sign_in_at`, to update at most once/hour" +merge_request: 11053 +author: -- cgit v1.2.3