Class: Members::ExpiringEmailNotificationWorker
- Inherits:
-
Object
- Object
- Members::ExpiringEmailNotificationWorker
- Includes:
- ApplicationWorker
- Defined in:
- app/workers/members/expiring_email_notification_worker.rb
Overview
rubocop:disable Scalability/CronWorkerContext
Constant Summary
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(member_id) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/workers/members/expiring_email_notification_worker.rb', line 12 def perform(member_id) notification_service = NotificationService.new member = ::Member.find_by_id(member_id) return unless member return unless Feature.enabled?(:member_expiring_email_notification, member.source.root_ancestor) return if member.expiry_notified_at.present? with_context(user: member.user) do notification_service.member_about_to_expire(member) Gitlab::AppLogger.info(message: "Notifying user about expiring membership", member_id: member.id) member.update(expiry_notified_at: Time.current) end end |