Importing Zeroconf inside of the method to prevent Travic-CI from breaking because of module not found

This commit is contained in:
Fabio Manganiello 2020-08-14 20:53:20 +02:00
parent 20b095232d
commit af2dbf899d
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,6 @@ from platypush.bus import Bus
from platypush.config import Config
from platypush.context import get_backend
from platypush.message.event.zeroconf import ZeroconfServiceAddedEvent, ZeroconfServiceRemovedEvent
from platypush.plugins.zeroconf import ZeroconfListener
from platypush.utils import set_timeout, clear_timeout, \
get_redis_queue_name_by_message, set_thread_name
@ -328,6 +327,7 @@ class Backend(Thread, EventGenerator):
"""
try:
from zeroconf import ServiceInfo, Zeroconf
from platypush.plugins.zeroconf import ZeroconfListener
except ImportError:
self.logger.warning('zeroconf package not available, service discovery will be disabled.')
return