Skip to content

Remove exclusive lease usage services/users/activity_service.rb

What does this MR do and why?

This change is based on the discussion in #441536 (comment 1882400417).

Based on the above discussion, we are in agreement that we need not use ExclusiveLease in this area anymore, as we already have an early return based on:

return if user.last_activity_on == today

This means that, ideally, a user's last_activity_on is just updated once per day.

Of course, non ideal conditions are possible, such as the first few requests of the day from this user being highly concurrent in nature. This could mean that the early return statement does not work as expected, and the execution will further proceed down.

user.update_attribute(:last_activity_on, today)

However, we are only updating the last_activity_on attribute of the user, that too to the same value, so this is kind of a harmless operation.

We still need to make sure that the analytics tracking events aren't a problem for such concurrent requests. I will loop in an engineer from groupanalytics instrumentation to make sure this is the case.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #441536

Edited by Manoj M J

Merge request reports