[BE] Track member last activity time
Background
In [Gitlab.com] Automatic removal of dormant members (&7533) we intend to add a feature to identify and remove dormant users from Namespaces for GitLab.com
This is similar to the existing SM feature ( &5519), but rather than deactivating users, we will remove members.
To achieve this, we will be adding a way to track member’s last activity timestamp within a namespace, so that we can identify dormant members and remove them if they've been dormant for greater than a predefined time period (e.g. 90 days).
Purpose
The purpose of this issue is to:
Add logic to update Member's last activity timestamp
We can follow the same path that was taken for Users#last_activity_on
for this, as it'll be used in much the same way.
The actions we will track last activity for are:
- Git HTTP/SSH activities (such as clone, push)
- Member visiting pages related to dashboards, projects, issues, merge requests, settings, etc.
- Member using the API
- Member using the GraphQL API
This list uses the User implementation as a basis, and was confirmed/defined in Define: Dormant Members (#460840 - closed).
Considerations
We should consider scale implications of this approach, as for each of these actions we will need to:
- find the group
- find the relevant
Member
record for the Group/User combination - Update the
Member
record - This should be behind a feature flag