Class: Users::ActivityService
- Inherits:
-
Object
- Object
- Users::ActivityService
- Defined in:
- app/services/users/activity_service.rb
Constant Summary collapse
- LEASE_TIMEOUT =
1.minute.to_i
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(author:, namespace: nil, project: nil) ⇒ ActivityService
constructor
A new instance of ActivityService.
Constructor Details
#initialize(author:, namespace: nil, project: nil) ⇒ ActivityService
Returns a new instance of ActivityService.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/services/users/activity_service.rb', line 7 def initialize(author:, namespace: nil, project: nil) @user = if .respond_to?(:username) elsif .respond_to?(:user) .user end @user = nil unless user.is_a?(User) @namespace = namespace @project = project end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/services/users/activity_service.rb', line 19 def execute return unless user return if user.last_activity_on == Date.today ::Gitlab::Database::LoadBalancing::SessionMap.current(user.load_balancer) .without_sticky_writes { record_activity } end |