status_workflow 4.0.0 → 4.0.1
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 +1 -4
- data/lib/status_workflow/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c974a37200e756f82b5de6b814a4a61172d96506dcd0cf2e6d1383a4744f070
|
4
|
+
data.tar.gz: ad90316c9b69c7ac63d36149793df79ad1d9e7f5904887794ed03ba3fe0f7314
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08ff82347394f556e384e5b0baa64eab148ae0a5a87543d055cf373b80daff1ac1e541c18764c7238c7e75a59459cbdcf38219e64ebb1bed992a54564d88174
|
7
|
+
data.tar.gz: e3e57bfefb975b854cdf7037318cd88f0b98d9ce9ff831885164ebf0ebb312a769b1f468d1690678b0e9be972b6789c0d080af9f0bfc5d92e29924b124a01227
|
data/CHANGELOG
CHANGED
data/lib/status_workflow.rb
CHANGED
@@ -19,7 +19,7 @@ module StatusWorkflow
|
|
19
19
|
end
|
20
20
|
|
21
21
|
LOCK_ACQUISITION_TIMEOUT = 8
|
22
|
-
LOCK_EXPIRY =
|
22
|
+
LOCK_EXPIRY = 8
|
23
23
|
LOCK_CHECK_RATE = 0.2
|
24
24
|
|
25
25
|
def status_transition!(intermediate_to_status, final_to_status, prefix = nil)
|
@@ -45,10 +45,8 @@ module StatusWorkflow
|
|
45
45
|
begin
|
46
46
|
# depend on #can_enter_X to reload
|
47
47
|
send "#{prefix_}can_enter_#{initial_to_status}?", true
|
48
|
-
raise TooSlow, "#{lock_key} lost lock after checking status" if Time.now - lock_obtained_at > LOCK_EXPIRY
|
49
48
|
if intermediate_to_status
|
50
49
|
update_columns status_column => intermediate_to_status, status_changed_at_column => Time.now
|
51
|
-
raise TooSlow, "#{lock_key} lost lock after setting intermediate status #{intermediate_to_status}" if Time.now - lock_obtained_at > LOCK_EXPIRY
|
52
50
|
end
|
53
51
|
# If a block was given, start a heartbeat thread
|
54
52
|
if block_given?
|
@@ -74,7 +72,6 @@ module StatusWorkflow
|
|
74
72
|
# Success!
|
75
73
|
if intermediate_to_status
|
76
74
|
send "#{prefix_}can_enter_#{final_to_status}?", true
|
77
|
-
raise TooSlow, "#{lock_key} lost lock after checking final status" if Time.now - lock_obtained_at > LOCK_EXPIRY
|
78
75
|
end
|
79
76
|
update_columns status_column => final_to_status, status_changed_at_column => Time.now
|
80
77
|
ensure
|
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: 4.0.
|
4
|
+
version: 4.0.1
|
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-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|