backburner-allq 1.0.35 → 1.0.36

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: dcdca608a5d89c656e3bac8e9c08a8609bd621c87a65627be816182047f72682
4
- data.tar.gz: 5b22e47c0e50d030e6b512b9b592b5e754281b6152f16225539074277458071b
3
+ metadata.gz: 6ac9dbeeb771c9821488a74064bc6bbe1e059cb9e4dc7faf4f25caf08054b4e6
4
+ data.tar.gz: 298634152be89db02b2b2898b57c9d2fbd9b27354c7b49068af6aadd5613dbe5
5
5
  SHA512:
6
- metadata.gz: ef7402c39f84323438ac0f8427943143f3f7e8ab82f56dd60669147098dc38d6fab2ab84a3a12d2fc0a751f270ac6cb3723ef800aa523b67b18f2e18290f76a5
7
- data.tar.gz: b5f5ba04f1bebb6e511cb4d32c3bf83f6c2fb5e0960b908a6d1ef90cbf206e39c9a7c4d9e38745ab7734de990313e24ab1142f724f71d94ef8e69f8a95c1ce33
6
+ metadata.gz: 34ee7a51b82f0362485e2346939f70d2bcb3db8412b72ccc237ebf63564b9bd9e9e26613e75fc0c2bdf3f9965ca0b96707db1130f35edfd93e475b7825bf7b9b
7
+ data.tar.gz: 27df1992ff07455872730e2d7d65638b4b63ee1670d4cddfe940de8f17ee27df002db0fba0b0086ea0da6bafedfdbfaea11f6c4acbc7671b9d95a9999600a057
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.35.gem
3
+ gem push backburner-allq-1.0.36.gem
@@ -1,3 +1,3 @@
1
1
  module Backburner
2
- VERSION = "1.0.35"
2
+ VERSION = "1.0.36"
3
3
  end
@@ -23,8 +23,13 @@ module Backburner
23
23
  # @example
24
24
  # Backburner::Worker.enqueue NewsletterSender, [self.id, user.id], :ttr => 1000
25
25
  #
26
- def self.enqueue(job_class, args=[], opts={})
27
- opts[:shard_key] = opts[:shard_key].nil? ? "X" : opts[:shard_key].to_s
26
+ def self.enqueue(job_class, args = [], opts = {})
27
+ # Invoke Procs if they are sent
28
+ opts.each_key do |k|
29
+ opts[k] = opts[k].call job_class, args if opts[k].instance_of?(Proc)
30
+ end
31
+
32
+ opts[:shard_key] = opts[:shard_key].nil? ? 'X' : opts[:shard_key].to_s
28
33
  pri = resolve_priority(opts[:pri] || job_class)
29
34
  delay = [0, opts[:delay].to_i].max
30
35
  ttr = resolve_respond_timeout(opts[:ttr] || job_class)
@@ -77,7 +82,7 @@ module Backburner
77
82
  #
78
83
  # @example
79
84
  # Worker.new(['test.job'])
80
- def initialize(tube_names=nil)
85
+ def initialize(tube_names = nil)
81
86
  @connection = new_connection
82
87
  @tube_names = self.process_tube_names(tube_names)
83
88
  register_signal_handlers!
@@ -29,15 +29,15 @@ describe "Backburner::Performable module" do
29
29
 
30
30
  describe "for async instance method" do
31
31
  it "should invoke worker enqueue" do
32
- Backburner::Worker.expects(:enqueue).with(PerformableTestObj, [56, :foo, true, false], has_entries(:pri => 5000, :queue => "foo"))
33
- PerformableTestObj.new.async(:pri => 5000, :queue => "foo").foo(true, false)
32
+ Backburner::Worker.expects(:enqueue).with(PerformableTestObj, [56, :foo, true, false], has_entries(:pri => 5000, :queue => "foo", :shard_key => "abc"))
33
+ PerformableTestObj.new.async(:pri => 5000, :queue => "foo", :shard_key => "abc").foo(true, false)
34
34
  end
35
35
  end # async instance
36
36
 
37
37
  describe "for async class method" do
38
38
  it "should invoke worker enqueue" do
39
- Backburner::Worker.expects(:enqueue).with(PerformableTestObj, [nil, :bar, true, false], has_entries(:pri => 5000, :queue => "foo"))
40
- PerformableTestObj.async(:pri => 5000, :queue => "foo").bar(true, false)
39
+ Backburner::Worker.expects(:enqueue).with(PerformableTestObj, [nil, :bar, true, false], has_entries(:pri => 5000, :queue => "foo", :shard_key => "abc"))
40
+ PerformableTestObj.async(:pri => 5000, :queue => "foo", :shard_key => "abc").bar(true, false)
41
41
  end
42
42
  end # async class
43
43
 
@@ -53,16 +53,16 @@ describe "Backburner::Performable module" do
53
53
 
54
54
  describe "for handle_asynchronously class method" do
55
55
  it "should automagically asynchronously proxy calls to the method" do
56
- Backburner::Performable.handle_asynchronously(AutomagicTestObj, :qux, :pri => 5000, :queue => "qux")
56
+ Backburner::Performable.handle_asynchronously(AutomagicTestObj, :qux, :pri => 5000, :queue => "qux", :shard_key => "abc")
57
57
 
58
- Backburner::Worker.expects(:enqueue).with(AutomagicTestObj, [56, :qux_without_async, true, false], has_entries(:pri => 5000, :queue => "qux"))
58
+ Backburner::Worker.expects(:enqueue).with(AutomagicTestObj, [56, :qux_without_async, true, false], has_entries(:pri => 5000, :queue => "qux", :shard_key => "abc"))
59
59
  AutomagicTestObj.new.qux(true, false)
60
60
  end
61
61
 
62
62
  it "should work for class methods, too" do
63
- Backburner::Performable.handle_static_asynchronously(AutomagicTestObj, :garply, :pri => 5000, :queue => "garply")
63
+ Backburner::Performable.handle_static_asynchronously(AutomagicTestObj, :garply, :pri => 5000, :queue => "garply", :shard_key => "abc")
64
64
 
65
- Backburner::Worker.expects(:enqueue).with(AutomagicTestObj, [nil, :garply_without_async, true, false], has_entries(:pri => 5000, :queue => "garply"))
65
+ Backburner::Worker.expects(:enqueue).with(AutomagicTestObj, [nil, :garply_without_async, true, false], has_entries(:pri => 5000, :queue => "garply", :shard_key => "abc"))
66
66
  AutomagicTestObj.garply(true, false)
67
67
  end
68
68
 
@@ -74,14 +74,14 @@ describe "Backburner::Performable module" do
74
74
  end
75
75
 
76
76
  it "should be available for instance methods on any class that includes the Performable module" do
77
- AsyncInstanceMethodsTestObj.handle_asynchronously :foo, pri: 5000, queue: 'qux'
78
- Backburner::Worker.expects(:enqueue).with(AsyncInstanceMethodsTestObj, [56, :foo_without_async, true, false], has_entries(:pri => 5000, :queue => "qux"))
77
+ AsyncInstanceMethodsTestObj.handle_asynchronously :foo, pri: 5000, queue: 'qux', shard_key: "abc"
78
+ Backburner::Worker.expects(:enqueue).with(AsyncInstanceMethodsTestObj, [56, :foo_without_async, true, false], has_entries(:pri => 5000, :queue => "qux", :shard_key => "abc"))
79
79
  AsyncInstanceMethodsTestObj.new.foo(true, false)
80
80
  end
81
81
 
82
82
  it "should be available for class methods on any class that includes the Performable module" do
83
- AsyncStaticMethodsTestObj.handle_static_asynchronously :bar, pri: 5000, queue: 'garply'
84
- Backburner::Worker.expects(:enqueue).with(AsyncStaticMethodsTestObj, [nil, :bar_without_async, true, false], has_entries(:pri => 5000, :queue => "garply"))
83
+ AsyncStaticMethodsTestObj.handle_static_asynchronously :bar, pri: 5000, queue: 'garply', shard_key: "abc"
84
+ Backburner::Worker.expects(:enqueue).with(AsyncStaticMethodsTestObj, [nil, :bar_without_async, true, false], has_entries(:pri => 5000, :queue => "garply",:shard_key => "abc"))
85
85
  AsyncStaticMethodsTestObj.bar(true, false)
86
86
  end
87
87
  end
data/test/test_helper.rb CHANGED
@@ -12,7 +12,7 @@ require File.expand_path('../helpers/templogger', __FILE__)
12
12
 
13
13
  # Configure Backburner
14
14
  Backburner.configure do |config|
15
- config.beanstalk_url = "beanstalk://127.0.0.1"
15
+ config.allq_url = "allq://127.0.0.1:8091"
16
16
  config.tube_namespace = "demo.test"
17
17
  end
18
18
 
@@ -88,7 +88,7 @@ class MiniTest::Spec
88
88
  end
89
89
 
90
90
  def beanstalk_connection
91
- Backburner::Connection.new(Backburner.configuration.beanstalk_url)
91
+ Backburner::Connection.new(Backburner.configuration.allq_url)
92
92
  end
93
93
 
94
94
  # pop_one_job(tube_name)
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.35
4
+ version: 1.0.36
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-12-29 00:00:00.000000000 Z
11
+ date: 2022-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: allq_rest