sidekiq_workflows 0.2.6 → 1.0.0
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 +4 -4
- data/lib/sidekiq_workflows/worker.rb +17 -5
- metadata +5 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfe14b006b243a658de47101698b0b0b47e73b881275745f17a13851cec71efc
|
4
|
+
data.tar.gz: 6b66f424a92e434152ffce19079435de9ec12884cc24cbf16e623d8571948082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c87521b82948cd1a084612c06556361d69e7a4739094aa1ba3b3cc65d1d79016773c0f39e10b7de8f17909d9b683a55871b594720a54aeb43e23daf417fdbe55
|
7
|
+
data.tar.gz: ffb5ef5cf0bd7f3bf23664d819ab4cd5b80040c009ad1fc3965611a890bdddd31fcbcd4dde19c00d8e633f8ff8077f58c584bcb95fa72c8d92c59a9eb612c139
|
@@ -17,7 +17,8 @@ module SidekiqWorkflows
|
|
17
17
|
child_batch = Sidekiq::Batch.new
|
18
18
|
child_batch.callback_queue = SidekiqWorkflows.callback_queue unless SidekiqWorkflows.callback_queue.nil?
|
19
19
|
child_batch.description = "Workflow #{workflow.workflow_uuid || '-'}"
|
20
|
-
child_batch.on(:
|
20
|
+
child_batch.on(:success, 'SidekiqWorkflows::Worker#on_success', workflow: workflow.serialize, workflow_uuid: workflow.workflow_uuid)
|
21
|
+
child_batch.on(:death, 'SidekiqWorkflows::Worker#on_death', workflow: workflow.serialize, workflow_uuid: workflow.workflow_uuid)
|
21
22
|
child_batch.jobs do
|
22
23
|
workflow.workers.each do |entry|
|
23
24
|
if entry[:delay]
|
@@ -31,7 +32,7 @@ module SidekiqWorkflows
|
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
|
-
def
|
35
|
+
def on_success(status, options)
|
35
36
|
workflow = ensure_deserialized(options['workflow'])
|
36
37
|
|
37
38
|
if workflow.on_partial_complete
|
@@ -39,24 +40,35 @@ module SidekiqWorkflows
|
|
39
40
|
ActiveSupport::Inflector.constantize(klass).new.send(method, status, options)
|
40
41
|
end
|
41
42
|
|
42
|
-
perform_children(status.parent_batch, workflow)
|
43
|
+
perform_children(status.parent_batch, workflow)
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_death(status, options)
|
47
|
+
workflow = ensure_deserialized(options['workflow'])
|
48
|
+
|
49
|
+
if workflow.on_partial_complete
|
50
|
+
klass, method = workflow.on_partial_complete.split('#')
|
51
|
+
ActiveSupport::Inflector.constantize(klass).new.send(method, status, options)
|
52
|
+
end
|
43
53
|
end
|
44
54
|
|
45
55
|
def self.perform_async(workflow, *args)
|
46
56
|
set(queue: worker_queue).send(:perform_async, workflow.serialize, *args)
|
47
57
|
end
|
48
58
|
|
49
|
-
def self.perform_workflow(workflow,
|
59
|
+
def self.perform_workflow(workflow, on_success: nil, on_success_options: {}, on_death: nil, on_death_options: {})
|
50
60
|
batch = Sidekiq::Batch.new
|
51
61
|
batch.callback_queue = SidekiqWorkflows.callback_queue unless SidekiqWorkflows.callback_queue.nil?
|
52
62
|
batch.description = "Workflow #{workflow.workflow_uuid || '-'} root batch"
|
53
|
-
batch.on(:
|
63
|
+
batch.on(:success, on_success, on_success_options.merge(workflow_uuid: workflow.workflow_uuid)) if on_success
|
64
|
+
batch.on(:death, on_death, on_death_options.merge(workflow_uuid: workflow.workflow_uuid)) if on_death
|
54
65
|
|
55
66
|
yield batch if block_given?
|
56
67
|
|
57
68
|
batch.jobs do
|
58
69
|
perform_async(workflow)
|
59
70
|
end
|
71
|
+
|
60
72
|
batch.bid
|
61
73
|
end
|
62
74
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq_workflows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marian Theisen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sidekiq-pro
|
@@ -18,20 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
- - "<"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '5'
|
21
|
+
version: 5.2.1
|
25
22
|
type: :runtime
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
requirements:
|
29
26
|
- - ">="
|
30
27
|
- !ruby/object:Gem::Version
|
31
|
-
version:
|
32
|
-
- - "<"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '5'
|
28
|
+
version: 5.2.1
|
35
29
|
- !ruby/object:Gem::Dependency
|
36
30
|
name: activesupport
|
37
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
131
|
- !ruby/object:Gem::Version
|
138
132
|
version: '0'
|
139
133
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.1.6
|
141
135
|
signing_key:
|
142
136
|
specification_version: 4
|
143
137
|
summary: Sidekiq extension providing a workflow API on top of Sidekiq Pro's batches
|