forked from platypush/platypush
FIX: Use a separate error handler for the Pushbullet backend that doesn't raise another exception (prevents maximum recursion errors in the logs caused by the interpreter entering an infinite loop of error handlers)
This commit is contained in:
parent
833e1c49be
commit
a6b552504e
1 changed files with 15 additions and 1 deletions
|
@ -135,6 +135,20 @@ class PushbulletBackend(Backend):
|
||||||
|
|
||||||
return callback
|
return callback
|
||||||
|
|
||||||
|
def on_error(self, *_):
|
||||||
|
def callback(*args):
|
||||||
|
self.logger.error(f'Pushbullet error: {args}')
|
||||||
|
try:
|
||||||
|
if self.listener:
|
||||||
|
self.listener.close()
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.error('Error on Pushbullet connection close upon error')
|
||||||
|
self.logger.exception(e)
|
||||||
|
finally:
|
||||||
|
self.listener = None
|
||||||
|
|
||||||
|
return callback
|
||||||
|
|
||||||
def on_open(self):
|
def on_open(self):
|
||||||
def callback(*_):
|
def callback(*_):
|
||||||
self.logger.info('Pushbullet service connected')
|
self.logger.info('Pushbullet service connected')
|
||||||
|
@ -149,7 +163,7 @@ class PushbulletBackend(Backend):
|
||||||
on_push=self.on_push(),
|
on_push=self.on_push(),
|
||||||
on_open=self.on_open(),
|
on_open=self.on_open(),
|
||||||
on_close=self.on_close(),
|
on_close=self.on_close(),
|
||||||
on_error=self.on_close(),
|
on_error=self.on_error(),
|
||||||
http_proxy_host=self.proxy_host,
|
http_proxy_host=self.proxy_host,
|
||||||
http_proxy_port=self.proxy_port)
|
http_proxy_port=self.proxy_port)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue