Class: RemoveExpiredMembersWorker
- Inherits:
-
Object
- Object
- RemoveExpiredMembersWorker
- Includes:
- ApplicationWorker, CronjobQueue
- Defined in:
- app/workers/remove_expired_members_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary collapse
- BATCH_SIZE =
1000
- BATCH_DELAY =
10.seconds
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Constants included from Gitlab::Loggable
Constants included from WorkerAttributes
WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
-
#perform(cursor = nil) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord.
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform(cursor = nil) ⇒ Object
rubocop: disable CodeReuse/ActiveRecord
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/workers/remove_expired_members_worker.rb', line 17 def perform(cursor = nil) @updated_count = 0 paginator = paginate(cursor) paginator.each { |member| process_member(member) } status = paginator.has_next_page? ? :limit_reached : :completed (:result, status: status, updated_rows: @updated_count ) return unless paginator.has_next_page? self.class.perform_in(BATCH_DELAY, paginator.cursor_for_next_page) end |