backburner-allq 1.0.20 → 1.0.21

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: ed4aae689c12e639f2f51a32aef5a59c80f0ab452f89fe2f29afb566474ba201
4
- data.tar.gz: 62e79b474949889a1b992b7fa25a034a1c87a62d1d6db0ba5f8a01582e464071
3
+ metadata.gz: 73c6bedb8b0e7244398f9b2c6fa59cd279cee9918f68f0f6774949930c76e37f
4
+ data.tar.gz: 9cf6c1693730748fef4e28c6125e250ff5088eb3ccf842037944a8ad438d8b72
5
5
  SHA512:
6
- metadata.gz: 8f5e2bd1006d8d39e95f25b85b195ad7b8cefd5b77a16dd93ab095ef0ca080d90e04b63490e66d9247b47e9f97d2355e5b2fa9fe03b2c85dd413efa54d642a32
7
- data.tar.gz: 26a7b05894906fc6d79f0e98b6bed0f67d5ea8c62b09c3b6b89acb89fb13811dc568353ce7432d89081ed79ff97f4f2da5c91ee5e20ba2131cddf10a875da7c0
6
+ metadata.gz: b3cbad666007e5bbdc55373d94bdb584ec7828461d5640388987d45bdc830f025883e9c7ba4798f3dec743eb174e2560742bd30231a1fc431b57f77627f54383
7
+ data.tar.gz: 41c1b8dc3ae52fe00de3e6af96fc9967f9ef39057e0f7eb97ef9bbe91cb9bae5404f61a51a8bf86d1b6a7edc3e67db6e0219beaad85a48310229fd3927436fdd
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in backburner.gemspec
4
4
  gemspec
5
+
6
+
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.20.gem
3
+ gem push backburner-allq-1.0.21.gem
@@ -81,6 +81,7 @@ module Backburner
81
81
  end
82
82
 
83
83
  class AllQWrapper
84
+ DEFAULT_TIMEOUT = 17800
84
85
  def initialize(url = 'localhost:8090')
85
86
  allq_conf = Allq::Configuration.new do |config|
86
87
  config.host = url
@@ -182,7 +183,7 @@ module Backburner
182
183
  def build_new_job(body, options)
183
184
  adjusted_priority = map_priority(options[:pri] || 5)
184
185
 
185
- ttl = options[:ttl] || 600
186
+ ttl = options[:ttl] || options[:ttr] || DEFAULT_TIMEOUT
186
187
  tube_name = options[:tube_name] || 'default'
187
188
  delay = options[:delay] || 0
188
189
  parent_id = options[:parent_id]
@@ -199,7 +200,7 @@ module Backburner
199
200
 
200
201
  def build_new_parent_job(body, options)
201
202
  adjusted_priority = map_priority(options[:pri] || 5)
202
- ttl = options[:ttl] || 600
203
+ ttl = options[:ttl] || options[:ttr] || DEFAULT_TIMEOUT
203
204
  tube_name = options[:tube_name] || 'default'
204
205
  delay = options[:delay] || 0
205
206
  parent_id = options[:parent_id]
@@ -25,6 +25,7 @@ module Backburner
25
25
  @body = task.body.is_a?(Hash) ? task.body : Backburner.configuration.job_parser_proc.call(task.body)
26
26
  @name = body["class"] || body[:class]
27
27
  @args = body["args"] || body[:args]
28
+ @ttr = body["ttr"] || body[:ttr]
28
29
  rescue => ex # Job was not valid format
29
30
  # self.bury
30
31
  # raise JobFormatInvalid, "Job body could not be parsed: #{ex.inspect}"
@@ -42,13 +43,13 @@ module Backburner
42
43
  # @example
43
44
  # @task.process
44
45
  #
45
- def process
46
+ def process
46
47
  # Invoke before hook and stop if false
47
48
  res = @hooks.invoke_hook_events(job_name, :before_perform, *args)
48
49
  return false unless res
49
50
  # Execute the job
50
51
  @hooks.around_hook_events(job_name, :around_perform, *args) do
51
- job_class.perform(*args)
52
+ timeout_job_after(@ttr > 1 ? @ttr - 1 : @ttr) { job_class.perform(*args) }
52
53
  end
53
54
  task.delete
54
55
  # Invoke after perform hook
@@ -1,3 +1,3 @@
1
1
  module Backburner
2
- VERSION = "1.0.20"
2
+ VERSION = "1.0.21"
3
3
  end
@@ -31,7 +31,7 @@ module Backburner
31
31
 
32
32
  return nil unless res # stop if hook is false
33
33
 
34
- data = { :class => job_class.name, :args => args }
34
+ data = { :class => job_class.name, :args => args, :ttr => ttr }
35
35
  queue = opts[:queue] && (Proc === opts[:queue] ? opts[:queue].call(job_class) : opts[:queue])
36
36
 
37
37
  begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backburner-allq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.20
4
+ version: 1.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Malcolm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-13 00:00:00.000000000 Z
11
+ date: 2021-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: allq_rest