Frequently update the last login time for users to reflect activity.
Review Request #10137 — Created Sept. 4, 2018 and submitted
User.last_loginstores the last time that a user went through a login
process, but given how long our sessions last, it's hard to get any
useful information on how often users are active on a server. This
change aims to improve upon this by repurposing this field to better
show recent activity.
Now, on each request, the new
UpdateLastLoginMiddlewarewill check if
the last login time is at least 30 minutes old and update it to the
current time. This means that login times will now represent activity on
the server within a 30 minute window, making the User Activity graph on
the Admin Dashboard more useful and helping when calculating usage for
Unit tests passed.
Manually tested that the last login time was updated when making a HTTP
request, and then didn't update again until a request over 30 minutes