status_workflow 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/lib/status_workflow.rb +5 -3
- data/lib/status_workflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1429ec0dd19bb00d60a21a13b222e2152d0e61a
|
4
|
+
data.tar.gz: 3a418f92be0f9d4ef97722ec7ae420ef0d3ba4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba51b05b15489ca77342bb35ad4e179c6fe0a00f5aaccc0c62d25e7b20a43e5eb803b8ff8cc4c6b14dd3f8d3a8952d89acd34cd58a5dc8cba1220fc2e2d382a
|
7
|
+
data.tar.gz: 734ce3e74ea19d0dcc96606f6bf513b8ac9e8ac034665d28e374c8a1af8f4eff660822e6cdab218a4cfd10b2c8c1fca6c31d69368f5f46a4c8f60fcac7a84cb1
|
data/CHANGELOG
CHANGED
data/lib/status_workflow.rb
CHANGED
@@ -23,6 +23,7 @@ module StatusWorkflow
|
|
23
23
|
LOCK_CHECK_RATE = 0.2
|
24
24
|
|
25
25
|
def status_transition!(intermediate_to_status, final_to_status, prefix = nil)
|
26
|
+
result = nil # what the block yields, return to the user
|
26
27
|
intermediate_to_status = intermediate_to_status&.to_s
|
27
28
|
final_to_status = final_to_status&.to_s
|
28
29
|
prefix_ = prefix ? "#{prefix}_" : nil
|
@@ -58,11 +59,12 @@ module StatusWorkflow
|
|
58
59
|
sleep LOCK_EXPIRY/2.0
|
59
60
|
end
|
60
61
|
end
|
61
|
-
yield
|
62
|
+
result = yield
|
62
63
|
rescue
|
63
64
|
# If the block errors, set status to error and record the backtrace
|
64
65
|
error = (["#{$!.class} #{$!.message}"] + $!.backtrace).join("\n")
|
65
|
-
|
66
|
+
status = read_attribute status_column
|
67
|
+
update_columns status_column => "#{status}_error", status_changed_at_column => Time.now, error_column => error
|
66
68
|
raise
|
67
69
|
end
|
68
70
|
end
|
@@ -77,7 +79,7 @@ module StatusWorkflow
|
|
77
79
|
StatusWorkflow.redis.del lock_key
|
78
80
|
heartbeat.kill if heartbeat
|
79
81
|
end
|
80
|
-
|
82
|
+
result
|
81
83
|
end
|
82
84
|
|
83
85
|
module ClassMethods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: status_workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seamus Abshere
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|