File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,11 @@ def run(self):
26
26
log .info ("Starting event consumer" )
27
27
self ._running = True
28
28
while self ._running :
29
- self .send ()
29
+ try :
30
+ self .send ()
31
+ except Exception :
32
+ log .exception (
33
+ 'Unhandled exception in event consumer' )
30
34
31
35
def stop (self ):
32
36
self ._running = False
@@ -53,11 +57,12 @@ def do_send(should_retry):
53
57
data = json_body )
54
58
r .raise_for_status ()
55
59
except ProtocolError as e :
56
- inner = e .args [1 ]
57
- if inner .errno == errno .ECONNRESET and should_retry :
58
- log .warning (
59
- 'ProtocolError exception caught while sending events. Retrying.' )
60
- do_send (False )
60
+ if e .args is not None and len (e .args ) > 1 and e .args [1 ] is not None :
61
+ inner = e .args [1 ]
62
+ if inner .errno is not None and inner .errno == errno .ECONNRESET and should_retry :
63
+ log .warning (
64
+ 'ProtocolError exception caught while sending events. Retrying.' )
65
+ do_send (False )
61
66
else :
62
67
log .exception (
63
68
'Unhandled exception in event consumer. Analytics events were not processed.' )
You can’t perform that action at this time.
0 commit comments