asynchronic 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa2c43c243d60d738f5467aa5e8a8dfff9dd18ed
4
- data.tar.gz: 94cc6363b4dee324e49915cea455cf84fa496520
3
+ metadata.gz: a8220de499b9584d4abdbcbd0a29771363e70da9
4
+ data.tar.gz: 25045acaa95af872f415efc7246dc623fab903ba
5
5
  SHA512:
6
- metadata.gz: 2ae20696ec3c1d91692251b79be632219569c63d3eaae28c619cc08ff051db0df4149da9a1f50b9ebf0d7725601195f2d553986cde00ea873b9cc0ca7ab2a790
7
- data.tar.gz: d81e1c116a0057cecd524cda9442e6b1649ad40fdf6090fbe0fcfc6c0ca052bd6dfd3a2261030358e920c8af9639b4ef967c964232720ae33617d3400a6bd627
6
+ metadata.gz: bac75531740aeb2584662776b1b3cd3511c74eeae3bdfad3d11fba758d98c03e155998fe6e83408719e52a2bd7f0c0593a1db6f271e6e005dee371f4a8bf3e83
7
+ data.tar.gz: f3c4a43bbef0fea2cf2189976df05e279aa4a248146024fade38c91454a869693a59a2f70d511b7f6acdbf786fa177c64bfa96d5f8910f75d26d6b0a0637f3c1
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby 2.1
1
+ ruby 2.0
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
3
  - 2.0
5
4
  - 2.1
5
+ - 2.2
6
6
  - jruby
7
7
  services:
8
8
  - redis-server
@@ -30,5 +30,13 @@ module Asynchronic
30
30
  nil
31
31
  end
32
32
 
33
+ def retry_when(exceptions, interval=1)
34
+ yield
35
+ rescue *exceptions => ex
36
+ Asynchronic.logger.error(self.class) { "Retry for: #{ex.class} #{ex.message}" }
37
+ sleep interval
38
+ retry
39
+ end
40
+
33
41
  end
34
42
  end
@@ -1,3 +1,3 @@
1
1
  module Asynchronic
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.0'
3
3
  end
data/spec/jobs.rb CHANGED
@@ -193,4 +193,15 @@ class ForwardReferenceJob < Asynchronic::Job
193
193
  params[:number] + 1
194
194
  end
195
195
  end
196
+ end
197
+
198
+ class WithRetriesJob < Asynchronic::Job
199
+ def call
200
+ @counter = 0
201
+ retry_when [RuntimeError] do
202
+ @counter += 1
203
+ raise 'Counter < 3' if @counter < 3
204
+ @counter
205
+ end
206
+ end
196
207
  end
@@ -383,4 +383,22 @@ module LifeCycleExamples
383
383
  queue.must_be_empty
384
384
  end
385
385
 
386
+ it 'Job with retries' do
387
+ process = create WithRetriesJob
388
+
389
+ process.must_be_initialized
390
+ queue.must_be_empty
391
+
392
+ process.enqueue
393
+
394
+ process.must_be_queued
395
+ queue.must_enqueued process
396
+
397
+ execute queue
398
+
399
+ process.must_be_completed
400
+ process.result.must_equal 3
401
+ queue.must_be_empty
402
+ end
403
+
386
404
  end
metadata CHANGED
@@ -1,167 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asynchronic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
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-05-15 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ost
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: class_config
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: transparent_proxy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: minitest
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
103
  version: '4.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ~>
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: minitest-great_expectations
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ~>
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0.0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ~>
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: turn
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.9'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.9'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: simplecov
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: pry
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  description: DSL for asynchronic pipeline
@@ -171,11 +171,11 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
- - ".coveralls.yml"
175
- - ".gitignore"
176
- - ".ruby-gemset"
177
- - ".ruby-version"
178
- - ".travis.yml"
174
+ - .coveralls.yml
175
+ - .gitignore
176
+ - .ruby-gemset
177
+ - .ruby-version
178
+ - .travis.yml
179
179
  - Gemfile
180
180
  - LICENSE.txt
181
181
  - README.md
@@ -231,17 +231,17 @@ require_paths:
231
231
  - lib
232
232
  required_ruby_version: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">="
234
+ - - '>='
235
235
  - !ruby/object:Gem::Version
236
236
  version: '0'
237
237
  required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  requirements:
239
- - - ">="
239
+ - - '>='
240
240
  - !ruby/object:Gem::Version
241
241
  version: '0'
242
242
  requirements: []
243
243
  rubyforge_project:
244
- rubygems_version: 2.4.3
244
+ rubygems_version: 2.4.8
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: DSL for asynchronic pipeline using queues over Redis