Class: Members::ExpiringWorker
- Inherits:
-
Object
- Object
- Members::ExpiringWorker
- Includes:
- ApplicationWorker, CronjobQueue
- Defined in:
- app/workers/members/expiring_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary collapse
- BATCH_LIMIT =
500
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_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::Loggable
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/workers/members/expiring_worker.rb', line 18 def perform return unless Feature.enabled?(:member_expiring_email_notification) limit_date = Member::DAYS_TO_EXPIRE.days.from_now.to_date expiring_members = Member.active.where(users: { user_type: :human }).expiring_and_not_notified(limit_date) # rubocop: disable CodeReuse/ActiveRecord expiring_members.each_batch(of: BATCH_LIMIT) do |members| members.pluck_primary_key.each do |member_id| Members::ExpiringEmailNotificationWorker.perform_async(member_id) end end end |