ElmerFudd 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ElmerFudd/version.rb +1 -1
- data/lib/ElmerFudd.rb +21 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e07e344020c0f10d943e0c707fd67ac20e7ffa06
|
4
|
+
data.tar.gz: a8e94119bcbf0e3c5a1abb684e0b4e3796c9e355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af150326413a1b669b66300a56bbafb9d63b8eb3db19f45880e17026ff9fdb92f1a6232dca85453573a62bc14efdb9319a48e14293a977a4c1d7b770043e787
|
7
|
+
data.tar.gz: 096b0eed055bde27fc76803560fd15eb46a88a0927e590c53a4f5c6c3e935a6f2e9c07521843440dfded6506422c0e47cc070696d3c4fbde1b0cf1d952af6590
|
data/lib/ElmerFudd/version.rb
CHANGED
data/lib/ElmerFudd.rb
CHANGED
@@ -202,15 +202,17 @@ module ElmerFudd
|
|
202
202
|
extend Filter
|
203
203
|
def self.call(env, message, filters)
|
204
204
|
retry_num = 0
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
205
|
+
begin
|
206
|
+
ActiveRecord::Base.connection_pool.with_connection do
|
207
|
+
call_next(env, message, filters)
|
208
|
+
end
|
209
|
+
rescue ActiveRecord::ConnectionTimeoutError
|
210
|
+
retry_num += 1
|
211
|
+
if retry_num <= 5
|
212
|
+
retry
|
213
|
+
else
|
214
|
+
raise
|
215
|
+
end
|
214
216
|
end
|
215
217
|
end
|
216
218
|
end
|
@@ -235,14 +237,16 @@ module ElmerFudd
|
|
235
237
|
|
236
238
|
def call(env, message, filters)
|
237
239
|
retry_num = 0
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
retry_num
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
240
|
+
begin
|
241
|
+
call_next(env, message, filters)
|
242
|
+
rescue @exception => e
|
243
|
+
if e.message =~ @exception_message_matches && retry_num < @times
|
244
|
+
retry_num += 1
|
245
|
+
Math.log(retry_num, 2)
|
246
|
+
retry
|
247
|
+
else
|
248
|
+
raise
|
249
|
+
end
|
246
250
|
end
|
247
251
|
end
|
248
252
|
end
|