blob: b14b7e67450790ab085223f06beec349d65cf834 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# frozen_string_literal: true
module Users
class DeactivateDormantUsersWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
data_consistency :always
include CronjobQueue
feature_category :utilization
def perform
return if Gitlab.com?
return unless ::Gitlab::CurrentSettings.current_application_settings.deactivate_dormant_users
deactivate_users(User.dormant)
deactivate_users(User.with_no_activity)
end
private
def deactivate_users(scope)
with_context(caller_id: self.class.name.to_s) do
scope.each_batch do |batch|
batch.each(&:deactivate)
end
end
end
end
end
|