forked from platypush/platypush
Ignore Redis errors when a backend sends an unregister notify event.
When that happens, it's most likely that the application is already stopping and the Redis service has already been terminated.
This commit is contained in:
parent
3bf068e0b2
commit
ec2b8da983
1 changed files with 17 additions and 10 deletions
|
@ -441,6 +441,8 @@ class Backend(Thread, EventGenerator, ExtensionWithManifest):
|
||||||
"""
|
"""
|
||||||
Unregister the Zeroconf service configuration if available.
|
Unregister the Zeroconf service configuration if available.
|
||||||
"""
|
"""
|
||||||
|
from redis import exceptions
|
||||||
|
|
||||||
if self.zeroconf and self.zeroconf_info:
|
if self.zeroconf and self.zeroconf_info:
|
||||||
try:
|
try:
|
||||||
self.zeroconf.unregister_service(self.zeroconf_info)
|
self.zeroconf.unregister_service(self.zeroconf_info)
|
||||||
|
@ -458,17 +460,22 @@ class Backend(Thread, EventGenerator, ExtensionWithManifest):
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.zeroconf_info:
|
try:
|
||||||
self.bus.post(
|
if self.zeroconf_info:
|
||||||
ZeroconfServiceRemovedEvent(
|
self.bus.post(
|
||||||
service_type=self.zeroconf_info.type,
|
ZeroconfServiceRemovedEvent(
|
||||||
service_name=self.zeroconf_info.name,
|
service_type=self.zeroconf_info.type,
|
||||||
|
service_name=self.zeroconf_info.name,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
else:
|
||||||
else:
|
self.bus.post(
|
||||||
self.bus.post(
|
ZeroconfServiceRemovedEvent(
|
||||||
ZeroconfServiceRemovedEvent(service_type=None, service_name=None)
|
service_type=None, service_name=None
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
except exceptions.ConnectionError:
|
||||||
|
pass
|
||||||
|
|
||||||
self.zeroconf_info = None
|
self.zeroconf_info = None
|
||||||
self.zeroconf = None
|
self.zeroconf = None
|
||||||
|
|
Loading…
Reference in a new issue