sidekiq-superworker 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -140,6 +140,30 @@ end
140
140
  MyBatchSuperworker.perform_async([30, 31, 32, 33, 34, 35])
141
141
  ```
142
142
 
143
+ You can also use multiple arguments:
144
+
145
+ ```ruby
146
+ Superworker.create(:MyBatchSuperworker, :user_ids, :comment_ids) do
147
+ batch user_ids: :user_id, comment_ids: :comment_id do
148
+ Worker1 :user_id, :comment_id
149
+ Worker2 :user_id
150
+ end
151
+ end
152
+
153
+ MyBatchSuperworker.perform_async([10, 11, 12], [20, 21, 22])
154
+ ```
155
+
156
+ The above produces the a sequence equivalent to this (the workers run serially):
157
+
158
+ ```ruby
159
+ Worker1.new.perform(10, 20)
160
+ Worker2.new.perform(10)
161
+ Worker1.new.perform(11, 21)
162
+ Worker2.new.perform(11)
163
+ Worker1.new.perform(12, 22)
164
+ Worker2.new.perform(12)
165
+ ```
166
+
143
167
  Grouping jobs into batches greatly improves your ability to audit them and determine when batches have finished.
144
168
 
145
169
  ### Superjob Names
@@ -141,12 +141,8 @@ module Sidekiq
141
141
  batch_keys_to_batch_values = @args.slice(*(batch_keys))
142
142
 
143
143
  batch_values = batch_keys_to_batch_values.values
144
- first_batch_value = batch_values.pop
145
- if batch_values.length > 0
146
- batch_values = first_batch_value.zip(batch_values)
147
- else
148
- batch_values = first_batch_value.zip
149
- end
144
+ first_batch_value = batch_values.shift
145
+ batch_values = first_batch_value.zip(*batch_values)
150
146
  batch_values
151
147
  end
152
148
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Superworker
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-superworker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-01-31 00:00:00.000000000 Z
12
+ date: 2014-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -48,17 +48,17 @@ dependencies:
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '3.2'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ! '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '3.2'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: sqlite3
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -80,17 +80,17 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: '2.12'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '2.12'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: database_cleaner
96
96
  requirement: !ruby/object:Gem::Requirement