fix: thread not dead
This commit is contained in:
parent
3b08714a84
commit
403c8f1b05
2 changed files with 11 additions and 8 deletions
|
|
@ -102,13 +102,15 @@ class Relay:
|
|||
message = self.queue.get(timeout=1)
|
||||
self.num_sent_events += 1
|
||||
self.ws.send(message)
|
||||
except Exception as e:
|
||||
if self.shutdown:
|
||||
logger.warning(f"Closing queue worker for '{self.url}'.")
|
||||
break
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
time.sleep(0.1)
|
||||
|
||||
if self.shutdown:
|
||||
logger.warning(f"Closing queue worker for '{self.url}'.")
|
||||
break
|
||||
|
||||
def add_subscription(self, id, filters: Filters):
|
||||
with self.lock:
|
||||
self.subscriptions[id] = Subscription(id, filters)
|
||||
|
|
|
|||
|
|
@ -44,12 +44,13 @@ class RelayManager:
|
|||
return relay
|
||||
|
||||
def remove_relay(self, url: str):
|
||||
self.threads[url].join(timeout=1)
|
||||
self.threads.pop(url)
|
||||
self.queue_threads[url].join(timeout=1)
|
||||
self.queue_threads.pop(url)
|
||||
self.relays[url].close()
|
||||
self.relays.pop(url)
|
||||
self.threads[url].join(timeout=5)
|
||||
self.threads.pop(url)
|
||||
self.queue_threads[url].join(timeout=5)
|
||||
self.queue_threads.pop(url)
|
||||
|
||||
|
||||
def add_subscription(self, id: str, filters: Filters):
|
||||
with self._subscriptions_lock:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue