Class: BatchManager::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/batch_manager/application_controller.rb

Direct Known Subclasses

BatchesController

Instance Method Summary collapse

Instance Method Details

#local_resque_worker?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/controllers/batch_manager/application_controller.rb', line 16

def local_resque_worker?
  Socket.gethostname == resque_worker_hostname
end

#resque_supported?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'app/controllers/batch_manager/application_controller.rb', line 7

def resque_supported?
  begin
    require 'resque'
    defined?(Resque) && resque_worker
  rescue LoadError
    false
  end
end

#resque_worker_hostnameObject



20
21
22
# File 'app/controllers/batch_manager/application_controller.rb', line 20

def resque_worker_hostname
  resque_worker.id.split(':')[0]
end