Class: RailsAsyncMigrations::Workers

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_async_migrations/workers.rb,
lib/rails_async_migrations/workers/sidekiq/check_queue_worker.rb,
lib/rails_async_migrations/workers/sidekiq/fire_migration_worker.rb

Defined Under Namespace

Modules: Sidekiq

Constant Summary collapse

ALLOWED =
[:check_queue, :fire_migration].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(called_worker) ⇒ Workers

Returns a new instance of Workers.



7
8
9
10
# File 'lib/rails_async_migrations/workers.rb', line 7

def initialize(called_worker)
  @called_worker = called_worker # :check_queue, :fire_migration
  ensure_worker_presence
end

Instance Attribute Details

#called_workerObject (readonly)

Returns the value of attribute called_worker.



5
6
7
# File 'lib/rails_async_migrations/workers.rb', line 5

def called_worker
  @called_worker
end

Instance Method Details

#perform(args = []) ⇒ Object



12
13
14
15
# File 'lib/rails_async_migrations/workers.rb', line 12

def perform(args = [])
  return unless ALLOWED.include? called_worker
  self.send called_worker, *args
end