Commit 8d26c863 authored by Fabio Manganiello's avatar Fabio Manganiello
Browse files

Keep the ntfy process in stop_wait state even when the plugin is configured with no subscriptions

parent 1da17fca
Pipeline #256 passed with stages
in 5 minutes and 13 seconds
......@@ -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()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment