sidekiq-superworker 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -133,7 +133,16 @@ module Sidekiq
|
|
133
133
|
|
134
134
|
def sidekiq_push(subjob, klass, jid)
|
135
135
|
# This is akin to perform_async, but it allows us to explicitly set the JID
|
136
|
-
|
136
|
+
item = sidekiq_item(subjob, klass, jid)
|
137
|
+
Sidekiq::Client.push(item)
|
138
|
+
end
|
139
|
+
|
140
|
+
def sidekiq_item(subjob, klass, jid)
|
141
|
+
item = { 'class' => klass, 'args' => subjob.arg_values, 'jid' => jid }
|
142
|
+
if subjob.meta && subjob.meta[:sidekiq]
|
143
|
+
item.merge!(subjob.meta[:sidekiq].stringify_keys)
|
144
|
+
end
|
145
|
+
item
|
137
146
|
end
|
138
147
|
end
|
139
148
|
end
|
@@ -10,14 +10,14 @@ module Sidekiq
|
|
10
10
|
|
11
11
|
def perform_async(*arg_values)
|
12
12
|
options = initialize_superjob(arg_values)
|
13
|
-
subjobs = create_subjobs(arg_values)
|
13
|
+
subjobs = create_subjobs(arg_values, options)
|
14
14
|
SuperjobProcessor.create(@superjob_id, @class_name, arg_values, subjobs, options)
|
15
15
|
end
|
16
16
|
|
17
17
|
protected
|
18
18
|
|
19
19
|
def initialize_superjob(arg_values)
|
20
|
-
options =
|
20
|
+
options = {}
|
21
21
|
|
22
22
|
# If an additional argument value is given, it's the superjob's options
|
23
23
|
if (arg_values.length == @arg_keys.length + 1) && arg_values.last.is_a?(Hash)
|
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.0
|
4
|
+
version: 0.1.0
|
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: 2013-
|
12
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|