backburner-allq 1.0.19 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 961c84a21c68a6bbe287105030dcbcf73e50177d647321dc410786b417ba653c
4
- data.tar.gz: bee092eb96d993ee4b34b4c1e9fa671cc92e4a3316179890be130dbe14cc70f1
3
+ metadata.gz: ed4aae689c12e639f2f51a32aef5a59c80f0ab452f89fe2f29afb566474ba201
4
+ data.tar.gz: 62e79b474949889a1b992b7fa25a034a1c87a62d1d6db0ba5f8a01582e464071
5
5
  SHA512:
6
- metadata.gz: a09fd305b986a90330434db34e13e961f4f6878bff406348fb246f03ac0a3e0b9b8216862128c62005e5b25a4338371cb341e57133aadaa1e3187066fee8698e
7
- data.tar.gz: 12fd13a7430682a5021d16ad32c7f3be1f39767413feeb2a96a7335c465d3639dfbd47905f43249aae27d23030c27a284fce36d098f7b6f396ac789182330efe
6
+ metadata.gz: 8f5e2bd1006d8d39e95f25b85b195ad7b8cefd5b77a16dd93ab095ef0ca080d90e04b63490e66d9247b47e9f97d2355e5b2fa9fe03b2c85dd413efa54d642a32
7
+ data.tar.gz: 26a7b05894906fc6d79f0e98b6bed0f67d5ea8c62b09c3b6b89acb89fb13811dc568353ce7432d89081ed79ff97f4f2da5c91ee5e20ba2131cddf10a875da7c0
data/deploy.sh CHANGED
@@ -1,3 +1,3 @@
1
1
  echo "Did you update the version?"
2
2
  gem build backburner-allq.gemspec
3
- gem push backburner-allq-1.0.19.gem
3
+ gem push backburner-allq-1.0.20.gem
@@ -22,7 +22,7 @@ module Backburner
22
22
 
23
23
  def initialize
24
24
  @allq_url = "allq://127.0.0.1:8091"
25
- @tube_namespace = "backallq"
25
+ @tube_namespace = "backburner"
26
26
  @namespace_separator = "."
27
27
  @default_priority = 5
28
28
  @respond_timeout = 120
@@ -1,3 +1,3 @@
1
1
  module Backburner
2
- VERSION = "1.0.19"
2
+ VERSION = "1.0.20"
3
3
  end
@@ -126,9 +126,14 @@ module Backburner
126
126
  # @example
127
127
  # @worker.work_one_job
128
128
  # @raise [Beaneater::NotConnected] If beanstalk fails to connect multiple times.
129
- def work_one_job(conn = connection)
129
+ def work_one_job(conn = connection, tube_name = nil)
130
+ if tube_name.nil?
131
+ self.log_error "Sampling tube, this is bad practice for Allq"
132
+ tube_name = @tube_names.sample
133
+ end
134
+
130
135
  begin
131
- job = reserve_job(conn)
136
+ job = reserve_job(conn, tube_name)
132
137
  rescue Exception => e
133
138
  self.log_error "Sleeping"
134
139
  self.log_error "Exception: #{e.full_message}"
@@ -158,8 +163,6 @@ module Backburner
158
163
  retry_status = "failed: attempt #{num_retries+1} of #{max_job_retries+1}"
159
164
  retry_delay = resolve_retry_delay(job.job_class)
160
165
  delay = resolve_retry_delay_proc(job.job_class).call(retry_delay, num_retries) rescue retry_delay
161
- puts "num_retries = #{num_retries}"
162
- puts "max_job_retries = #{max_job_retries}"
163
166
 
164
167
  if num_retries + 1 > max_job_retries
165
168
  job.bury
@@ -185,8 +188,8 @@ module Backburner
185
188
  end
186
189
 
187
190
  # Reserve a job from the watched queues
188
- def reserve_job(conn, reserve_timeout = Backburner.configuration.reserve_timeout)
189
- job = conn.get(@tube_names.sample)
191
+ def reserve_job(conn, tube_name, reserve_timeout = Backburner.configuration.reserve_timeout)
192
+ job = conn.get(tube_name)
190
193
  return nil if job.nil? || job.body == nil?
191
194
  Backburner::Job.new(job)
192
195
  end
@@ -58,7 +58,7 @@ module Backburner
58
58
  loop do
59
59
  begin
60
60
  break if @in_shutdown
61
- work_one_job(memo_connection)
61
+ work_one_job(memo_connection, tube_name)
62
62
  rescue => e
63
63
  log_error("Exception caught in thread pool loop. Continuing. -> #{e.message}\nBacktrace: #{e.backtrace}")
64
64
  end
@@ -210,7 +210,7 @@ module Backburner
210
210
  puts "Run while can"
211
211
  while @garbage_after.nil? or @garbage_after > @runs
212
212
  @runs += 1 # FIXME: Likely race condition
213
- ran_job = work_one_job(conn)
213
+ ran_job = work_one_job(conn, @watched_tube_name)
214
214
  # Wait a second if we didn't find a job
215
215
  unless ran_job
216
216
  puts "sleeping"
@@ -221,6 +221,7 @@ module Backburner
221
221
 
222
222
  # Shortcut for watching a tube on our beanstalk connection
223
223
  def watch_tube(name, conn = connection)
224
+ @watched_tube_name = name
224
225
  # No op for allq
225
226
  end
226
227
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backburner-allq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.19
4
+ version: 1.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Malcolm