forked from platypush/platypush
Keep the ntfy process in stop_wait state even when the plugin is configured with no subscriptions
This commit is contained in:
parent
1da17fca35
commit
8d26c8634d
1 changed files with 4 additions and 4 deletions
|
@ -53,16 +53,13 @@ class NtfyPlugin(RunnablePlugin):
|
|||
self._ws_proc = None
|
||||
|
||||
def _connect(self):
|
||||
if self.should_stop():
|
||||
if self.should_stop() or (self._ws_proc and self._ws_proc.is_alive()):
|
||||
self.logger.debug('Already connected')
|
||||
return
|
||||
|
||||
self._ws_proc = multiprocessing.Process(target=self._ws_process)
|
||||
self._ws_proc.start()
|
||||
|
||||
while not self._should_stop.is_set():
|
||||
self._should_stop.wait(timeout=1)
|
||||
|
||||
async def _get_ws_handler(self, url):
|
||||
reconnect_wait_secs = 1
|
||||
reconnect_wait_secs_max = 60
|
||||
|
@ -125,6 +122,9 @@ class NtfyPlugin(RunnablePlugin):
|
|||
if self._subscriptions:
|
||||
self._connect()
|
||||
|
||||
while not self._should_stop.is_set():
|
||||
self._should_stop.wait(timeout=1)
|
||||
|
||||
def stop(self):
|
||||
if self._ws_proc:
|
||||
self._ws_proc.kill()
|
||||
|
|
Loading…
Reference in a new issue