Module: Backburner::Queue::ClassMethods

Defined in:
lib/backburner/queue.rb

Instance Method Summary collapse

Instance Method Details

#queue(name = nil) ⇒ Object

Returns or assigns queue name for this job.

Examples:

queue "some.task.name"
@klass.queue # => "some.task.name"


24
25
26
27
28
29
30
# File 'lib/backburner/queue.rb', line 24

def queue(name=nil)
  if name
    @queue_name = name
  else # accessor
    (@queue_name.is_a?(Proc) ? @queue_name.call(self) : @queue_name) || Backburner.configuration.primary_queue
  end
end

#queue_garbage_limit(limit = nil) ⇒ Object

Returns or assigns queue jobs garbage limit (only ThreadsOnFork Worker)

Examples:

queue_garbage_limit 1000
@klass.queue_garbage_limit # => 1000


122
123
124
125
126
127
128
# File 'lib/backburner/queue.rb', line 122

def queue_garbage_limit(limit=nil)
  if limit
    @queue_garbage_limit = limit
  else #accessor
    @queue_garbage_limit
  end
end

#queue_jobs_limit(limit = nil) ⇒ Object

Returns or assigns queue parallel active jobs limit (only ThreadsOnFork and Threading workers)

Examples:

queue_jobs_limit 5
@klass.queue_jobs_limit # => 5


108
109
110
111
112
113
114
# File 'lib/backburner/queue.rb', line 108

def queue_jobs_limit(limit=nil)
  if limit
    @queue_jobs_limit = limit
  else #accessor
    @queue_jobs_limit
  end
end

#queue_max_job_retries(delay = nil) ⇒ Object

Returns or assigns queue max_job_retries for this job

Examples:

queue_max_job_retries 120
@klass.queue_max_job_retries # => 120


66
67
68
69
70
71
72
# File 'lib/backburner/queue.rb', line 66

def queue_max_job_retries(delay=nil)
  if delay
    @queue_max_job_retries = delay
  else # accessor
    @queue_max_job_retries
  end
end

#queue_priority(pri = nil) ⇒ Object

Returns or assigns queue priority for this job

Examples:

queue_priority 120
@klass.queue_priority # => 120


38
39
40
41
42
43
44
# File 'lib/backburner/queue.rb', line 38

def queue_priority(pri=nil)
  if pri
    @queue_priority = pri
  else # accessor
    @queue_priority
  end
end

#queue_respond_timeout(ttr = nil) ⇒ Object

Returns or assigns queue respond_timeout for this job

Examples:

queue_respond_timeout 120
@klass.queue_respond_timeout # => 120


52
53
54
55
56
57
58
# File 'lib/backburner/queue.rb', line 52

def queue_respond_timeout(ttr=nil)
  if ttr
    @queue_respond_timeout = ttr
  else # accessor
    @queue_respond_timeout
  end
end

#queue_retry_delay(delay = nil) ⇒ Object

Returns or assigns queue retry_delay for this job

Examples:

queue_retry_delay 120
@klass.queue_retry_delay # => 120


80
81
82
83
84
85
86
# File 'lib/backburner/queue.rb', line 80

def queue_retry_delay(delay=nil)
  if delay
    @queue_retry_delay = delay
  else # accessor
    @queue_retry_delay
  end
end

#queue_retry_delay_proc(proc = nil) ⇒ Object

Returns or assigns queue retry_delay_proc for this job

Examples:

queue_retry_delay_proc lambda { |min_retry_delay, num_retries| min_retry_delay + (num_retries ** 2) }
@klass.queue_retry_delay_proc # => lambda { |min_retry_delay, num_retries| min_retry_delay + (num_retries ** 2) }


94
95
96
97
98
99
100
# File 'lib/backburner/queue.rb', line 94

def queue_retry_delay_proc(proc=nil)
  if proc
    @queue_retry_delay_proc = proc
  else # accessor
    @queue_retry_delay_proc
  end
end

#queue_retry_limit(limit = nil) ⇒ Object

Returns or assigns queue retry limit (only ThreadsOnFork worker)

Examples:

queue_retry_limit 6
@klass.queue_retry_limit # => 6


136
137
138
139
140
141
142
# File 'lib/backburner/queue.rb', line 136

def queue_retry_limit(limit=nil)
  if limit
    @queue_retry_limit = limit
  else #accessor
    @queue_retry_limit
  end
end