mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
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:
@@ -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.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user