exception_notification_moderate 0.0.2 → 0.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e20a0eaf3ea67c0d3113ec14b2be957442f93df6
|
4
|
+
data.tar.gz: fcb57ad5190691dc3adb0c3abeb8976fe64074ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1bc9ca04a5c433266d547eaa6bfacdd6e8bd01ac504d882ad2f27c1aa53a1836f9b5d3352d42eb5c4320c15b350b174256778461d6b95c87baef2c338753ef5
|
7
|
+
data.tar.gz: 0f2b84471d4f96ba8a60f19857260d805c23787413a1e99c6609fa727c21cdc99c7e0968bc182e655e56d8b99742c0a4492a428b04cf367ae3c94d1cd54164ae
|
@@ -7,20 +7,15 @@ module ExceptionNotifier
|
|
7
7
|
|
8
8
|
def notify_exception(exception, options={})
|
9
9
|
ex_key = exception_key(exception)
|
10
|
-
|
11
|
-
|
12
|
-
rescue Redis::CannotConnectError
|
13
|
-
end
|
10
|
+
|
11
|
+
val = execute_with_rescue_error { redis.get(ex_key) }
|
14
12
|
if val && val.to_i + 60 > Time.now.to_i
|
15
13
|
# Write log and return.
|
16
14
|
ExceptionNotificationModerate.logger.info(exception)
|
17
15
|
return false
|
18
16
|
end
|
19
17
|
|
20
|
-
|
21
|
-
redis.set(ex_key, Time.now.to_i)
|
22
|
-
rescue Redis::CannotConnectError
|
23
|
-
end
|
18
|
+
execute_with_rescue_error { redis.set(ex_key, Time.now.to_i) }
|
24
19
|
original_notify_exception(exception, options)
|
25
20
|
end
|
26
21
|
|
@@ -30,6 +25,11 @@ module ExceptionNotifier
|
|
30
25
|
"#{exception.to_s}_#{exception.message}"
|
31
26
|
end
|
32
27
|
|
28
|
+
def execute_with_rescue_error
|
29
|
+
yield
|
30
|
+
rescue Redis::CannotConnectError, SocketError
|
31
|
+
end
|
32
|
+
|
33
33
|
def redis
|
34
34
|
if ExceptionNotificationModerate.redis_host
|
35
35
|
Redis.new(host: ExceptionNotificationModerate.redis_host)
|