Class: MailScheduler::NotificationServiceWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker, MailSchedulerQueue
Defined in:
app/workers/mail_scheduler/notification_service_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Gitlab::Loggable

Gitlab::Loggable::ANONYMOUS

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MailSchedulerQueue

#notification_service

Methods included from Gitlab::Loggable

#build_structured_payload

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Class Method Details

.perform_async(*args) ⇒ Object



37
38
39
# File 'app/workers/mail_scheduler/notification_service_worker.rb', line 37

def self.perform_async(*args)
  super(*ActiveJob::Arguments.serialize(args))
end

Instance Method Details

#perform(meth, *args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/workers/mail_scheduler/notification_service_worker.rb', line 18

def perform(meth, *args)
  check_arguments!(args)

  if NotificationService.permitted_actions.exclude?(meth.to_sym)
    raise(ArgumentError, "#{meth} not allowed for #{self.class.name}")
  end

  deserialized_args = ActiveJob::Arguments.deserialize(args)
  notification_service.public_send(meth, *deserialized_args) # rubocop:disable GitlabSecurity/PublicSend
rescue ActiveJob::DeserializationError
  # No-op.
  # This exception gets raised when an argument
  # is correct (deserializeable), but it still cannot be deserialized.
  # This can happen when an object has been deleted after
  # rails passes this job to sidekiq, but before
  # sidekiq gets it for execution.
  # In this case just do nothing.
end