Class: BackgroundQueue::Worker::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/background_queue/worker/config.rb

Constant Summary collapse

@@worker_path =
nil
@@process_name_prefix =
"bgq"

Class Method Summary collapse

Class Method Details

.default_worker_pathObject



28
29
30
31
32
33
34
35
36
# File 'lib/background_queue/worker/config.rb', line 28

def self.default_worker_path
  if defined?(RAILS_ROOT)
    File.join(RAILS_ROOT, "lib", "bgq_workers")
  elsif defined?(Rails) 
    File.join(Rails.root, "lib", "bgq_workers")
  else
    raise "You must specify the BackgroundQueue::Worker::Config.worker_path"
  end
end

.process_name_prefixObject



53
54
55
# File 'lib/background_queue/worker/config.rb', line 53

def self.process_name_prefix
  @@process_name_prefix
end

.process_name_prefix=(prefix) ⇒ Object



49
50
51
# File 'lib/background_queue/worker/config.rb', line 49

def self.process_name_prefix=(prefix)
  @@process_name_prefix = prefix
end

.secretObject



12
13
14
# File 'lib/background_queue/worker/config.rb', line 12

def self.secret
  @@secret
end

.secret=(auth) ⇒ Object



8
9
10
# File 'lib/background_queue/worker/config.rb', line 8

def self.secret=(auth)
  @@secret = auth
end

.separate_logs=(use_separate_logs) ⇒ Object



38
39
40
# File 'lib/background_queue/worker/config.rb', line 38

def self.separate_logs=(use_separate_logs)
  @separate_logs = use_separate_logs
end

.separate_logs?Boolean

should the worker have its own log file per instance? (makes it easier to backtrack errors) if true, the log file is based on the job id. Each log line will have the task id.

Returns:

  • (Boolean)


44
45
46
# File 'lib/background_queue/worker/config.rb', line 44

def self.separate_logs?
  @separate_logs
end

.worker_pathObject



20
21
22
23
24
25
26
# File 'lib/background_queue/worker/config.rb', line 20

def self.worker_path
  if @@worker_path.nil?
    default_worker_path
  else
    @@worker_path
  end
end

.worker_path=(path) ⇒ Object



16
17
18
# File 'lib/background_queue/worker/config.rb', line 16

def self.worker_path=(path)
  @@worker_path = path
end