mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
IRCNetwork: potentially fix queue thread shutdowns (#558)
Replace unreliable appendleft() usage with replacing the first element (or adding None if the queue is empty).
This commit is contained in:
parent
9a5072824d
commit
6c65d5523e
10
classes.py
10
classes.py
@ -1450,9 +1450,13 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
||||
self._socket.close()
|
||||
|
||||
# Stop the queue thread.
|
||||
if self._queue:
|
||||
# XXX: queue.Queue.queue isn't actually documented, so this is probably not reliable in the long run.
|
||||
self._queue.queue.appendleft(None)
|
||||
if self._queue is not None:
|
||||
try:
|
||||
# XXX: queue.Queue.queue isn't actually documented, so this is probably not reliable in the long run.
|
||||
with self._queue.mutex:
|
||||
self._queue.queue[0] = None
|
||||
except IndexError:
|
||||
self._queue.put(None)
|
||||
|
||||
# Stop the ping timer.
|
||||
if self._ping_timer:
|
||||
|
Loading…
Reference in New Issue
Block a user