Give threads less time to shut down gracefully. Attempt shutdown() rather than stop() on the telnet connections to see if that improves things

This commit is contained in:
Ian Renton
2026-09-19 15:07:31 +01:00
parent 0eb4553406
commit f45b7d51b0
23 changed files with 40 additions and 30 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ class APRSIS(SpotProvider):
if self._aprsis:
self._aprsis.close()
if self._thread:
self._thread.join(timeout=15)
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning("APRS-IS worker thread did not exit on time and will be killed.")
+6 -1
View File
@@ -1,5 +1,6 @@
import logging
import re
import socket
from datetime import datetime
from threading import Event, Lock, Thread
@@ -52,9 +53,13 @@ class DXCluster(SpotProvider):
self._stop_event.set()
with self._telnet_lock:
if self._telnet:
try:
self._telnet.sock.shutdown(socket.SHUT_RDWR)
except (AttributeError, OSError):
pass
self._telnet.close()
if self._thread:
self._thread.join(timeout=15)
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"DX Cluster {self._hostname} worker thread did not exit on time and will be killed.")
+1 -1
View File
@@ -35,7 +35,7 @@ class HTTPSpotProvider(SpotProvider):
self._stop_event.set()
self._wakeup_event.set()
if self._thread:
self._thread.join(timeout=35)
self._thread.join(timeout=12)
if self._thread.is_alive():
logger.warning(f"{self.name} spot worker thread did not exit on time and will be killed.")
+6 -1
View File
@@ -1,5 +1,6 @@
import logging
import re
import socket
from datetime import datetime
from threading import Event, Lock, Thread
@@ -41,9 +42,13 @@ class RBN(SpotProvider):
self._stop_event.set()
with self._telnet_lock:
if self._telnet:
try:
self._telnet.sock.shutdown(socket.SHUT_RDWR)
except (AttributeError, OSError):
pass
self._telnet.close()
if self._thread:
self._thread.join(timeout=15)
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"RBN (port {self._port!s}) worker thread did not exit on time and will be killed.")
+1 -1
View File
@@ -42,7 +42,7 @@ class SSESpotProvider(SpotProvider):
logger.exception(f"Exception closing SSE connection for {self.name} during stop()")
if self._thread:
self._thread.join(timeout=15)
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"{self.name} SSE worker thread did not exit on time and will be killed.")
+1 -1
View File
@@ -34,7 +34,7 @@ class WebsocketSpotProvider(SpotProvider):
if self._ws:
self._ws.close()
if self._thread:
self._thread.join(timeout=15)
self._thread.join(timeout=5)
if self._thread.is_alive():
logger.warning(f"{self.name} websocket worker thread did not exit on time and will be killed.")