This MR adds a cron worker that persists the last activity of users that were active the day before.
The cron is runs at 00:30 every day and loop per batch of 100 users (to avoid a too high query pressure).
The two first commits will be backported to CE.
What this MR does:
Backfill from latest
Post-deployment migration migrates
last_activity_onfrom Redis, and fallback to
Tested on MySQL
For ~1 million users (1/3 with activity in Redis, 1/3 with a
current_sign_in_atand 1/3 with a
created_at, the migrations takes around ~3-4 minutes
- Snippet used to create a lot of users with initial data to migrate: https://gitlab.com/gitlab-org/gitlab-ce/snippets/1655865
Migration approved by a DB/migration specialist
Squash commits to be backported to CE into a few logical ones
Backport some commits to CE