asynchronic 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asynchronic.rb +13 -0
- data/lib/asynchronic/process.rb +6 -2
- data/lib/asynchronic/queue_engine/ost.rb +3 -1
- data/lib/asynchronic/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa2c43c243d60d738f5467aa5e8a8dfff9dd18ed
|
4
|
+
data.tar.gz: 94cc6363b4dee324e49915cea455cf84fa496520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae20696ec3c1d91692251b79be632219569c63d3eaae28c619cc08ff051db0df4149da9a1f50b9ebf0d7725601195f2d553986cde00ea873b9cc0ca7ab2a790
|
7
|
+
data.tar.gz: d81e1c116a0057cecd524cda9442e6b1649ad40fdf6090fbe0fcfc6c0ca052bd6dfd3a2261030358e920c8af9639b4ef967c964232720ae33617d3400a6bd627
|
data/lib/asynchronic.rb
CHANGED
@@ -17,6 +17,8 @@ module Asynchronic
|
|
17
17
|
attr_config :data_store, DataStore::InMemory.new
|
18
18
|
attr_config :logger, Logger.new($stdout)
|
19
19
|
|
20
|
+
WAITING_TO_RETRY = 30
|
21
|
+
|
20
22
|
def self.environment
|
21
23
|
Environment.new queue_engine, data_store
|
22
24
|
end
|
@@ -29,4 +31,15 @@ module Asynchronic
|
|
29
31
|
environment.processes
|
30
32
|
end
|
31
33
|
|
34
|
+
def self.retry_execution(a_class, message)
|
35
|
+
begin
|
36
|
+
result = yield
|
37
|
+
rescue Exception => ex
|
38
|
+
logger.info(a_class) { "Retrying #{message}. ERROR: #{ex.message}" }
|
39
|
+
sleep WAITING_TO_RETRY
|
40
|
+
retry
|
41
|
+
end
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
32
45
|
end
|
data/lib/asynchronic/process.rb
CHANGED
@@ -79,7 +79,9 @@ module Asynchronic
|
|
79
79
|
|
80
80
|
def execute
|
81
81
|
run
|
82
|
-
wakeup
|
82
|
+
Asynchronic.retry_execution(self.class, 'wakeup') do
|
83
|
+
wakeup
|
84
|
+
end
|
83
85
|
end
|
84
86
|
|
85
87
|
def wakeup
|
@@ -168,7 +170,9 @@ module Asynchronic
|
|
168
170
|
rescue Exception => ex
|
169
171
|
message = "Failed process #{type} (#{id})\n#{ex.class} #{ex.message}\n#{ex.backtrace.join("\n")}"
|
170
172
|
Asynchronic.logger.error('Asynchronic') { message }
|
171
|
-
abort
|
173
|
+
Asynchronic.retry_execution(self.class, 'abort') do
|
174
|
+
abort! ex
|
175
|
+
end
|
172
176
|
end
|
173
177
|
|
174
178
|
def infer_dependencies(params)
|
data/lib/asynchronic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asynchronic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Naiman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
requirements: []
|
243
243
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.4.3
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: DSL for asynchronic pipeline using queues over Redis
|