mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 06:17:41 +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
-1
@@ -35,7 +35,7 @@ class CleanupTimer:
|
|||||||
|
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=15)
|
self._thread.join(timeout=5)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning("Cleanup worker thread did not exit on time and will be killed.")
|
logger.warning("Cleanup worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class DataProviders:
|
|||||||
for t in threads:
|
for t in threads:
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
deadline = time.monotonic() + 40
|
deadline = time.monotonic() + 15
|
||||||
for t in threads:
|
for t in threads:
|
||||||
t.join(timeout=max(0.0, deadline - time.monotonic()))
|
t.join(timeout=max(0.0, deadline - time.monotonic()))
|
||||||
still_running = [t for t in threads if t.is_alive()]
|
still_running = [t for t in threads if t.is_alive()]
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class HTTPAlertProvider(AlertProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} alert worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} alert worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class FileDownloadCallsignDataProvider(CallsignDataProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} callsign data worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} callsign data worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class FileDownloadSIGRefDataProvider(SIGRefDataProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
super().stop()
|
super().stop()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.sig_name} SIG ref data worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.sig_name} SIG ref data worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class GIROIonosonde(SolarConditionsProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning("GIRO ionosonde worker thread did not exit on time and will be killed.")
|
logger.warning("GIRO ionosonde worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class HTTPSolarConditionsProvider(SolarConditionsProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} solar conditions worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} solar conditions worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class KC2GProp(SolarConditionsProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning("KC2G ionosonde worker thread did not exit on time and will be killed.")
|
logger.warning("KC2G ionosonde worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class APRSIS(SpotProvider):
|
|||||||
if self._aprsis:
|
if self._aprsis:
|
||||||
self._aprsis.close()
|
self._aprsis.close()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=15)
|
self._thread.join(timeout=5)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning("APRS-IS worker thread did not exit on time and will be killed.")
|
logger.warning("APRS-IS worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
import socket
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from threading import Event, Lock, Thread
|
from threading import Event, Lock, Thread
|
||||||
|
|
||||||
@@ -52,9 +53,13 @@ class DXCluster(SpotProvider):
|
|||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
with self._telnet_lock:
|
with self._telnet_lock:
|
||||||
if self._telnet:
|
if self._telnet:
|
||||||
|
try:
|
||||||
|
self._telnet.sock.shutdown(socket.SHUT_RDWR)
|
||||||
|
except (AttributeError, OSError):
|
||||||
|
pass
|
||||||
self._telnet.close()
|
self._telnet.close()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=15)
|
self._thread.join(timeout=5)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"DX Cluster {self._hostname} worker thread did not exit on time and will be killed.")
|
logger.warning(f"DX Cluster {self._hostname} worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class HTTPSpotProvider(SpotProvider):
|
|||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
self._wakeup_event.set()
|
self._wakeup_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} spot worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} spot worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
import socket
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from threading import Event, Lock, Thread
|
from threading import Event, Lock, Thread
|
||||||
|
|
||||||
@@ -41,9 +42,13 @@ class RBN(SpotProvider):
|
|||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
with self._telnet_lock:
|
with self._telnet_lock:
|
||||||
if self._telnet:
|
if self._telnet:
|
||||||
|
try:
|
||||||
|
self._telnet.sock.shutdown(socket.SHUT_RDWR)
|
||||||
|
except (AttributeError, OSError):
|
||||||
|
pass
|
||||||
self._telnet.close()
|
self._telnet.close()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=15)
|
self._thread.join(timeout=5)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"RBN (port {self._port!s}) worker thread did not exit on time and will be killed.")
|
logger.warning(f"RBN (port {self._port!s}) worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class SSESpotProvider(SpotProvider):
|
|||||||
logger.exception(f"Exception closing SSE connection for {self.name} during stop()")
|
logger.exception(f"Exception closing SSE connection for {self.name} during stop()")
|
||||||
|
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=15)
|
self._thread.join(timeout=5)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} SSE worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} SSE worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class WebsocketSpotProvider(SpotProvider):
|
|||||||
if self._ws:
|
if self._ws:
|
||||||
self._ws.close()
|
self._ws.close()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=15)
|
self._thread.join(timeout=5)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} websocket worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} websocket worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class FileDownloadStaticDataProvider(StaticDataProvider):
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
self._stop_event.set()
|
self._stop_event.set()
|
||||||
if self._thread:
|
if self._thread:
|
||||||
self._thread.join(timeout=35)
|
self._thread.join(timeout=12)
|
||||||
if self._thread.is_alive():
|
if self._thread.is_alive():
|
||||||
logger.warning(f"{self.name} static data worker thread did not exit on time and will be killed.")
|
logger.warning(f"{self.name} static data worker thread did not exit on time and will be killed.")
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/add-spot.js?v=1789811377"></script>
|
<script src="/static/js/add-spot.js?v=1789826851"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-add-spot").addClass("active");
|
$("#nav-link-add-spot").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/alerts.js?v=1789811377"></script>
|
<script src="/static/js/alerts.js?v=1789826852"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-alerts").addClass("active");
|
$("#nav-link-alerts").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789811377"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789826851"></script>
|
||||||
<script src="/static/js/bands.js?v=1789811377"></script>
|
<script src="/static/js/bands.js?v=1789826851"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-bands").addClass("active");
|
$("#nav-link-bands").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
{% extends "skeleton.html" %}
|
{% extends "skeleton.html" %}
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/css/style.css?v=1789811377" type="text/css">
|
<link rel="stylesheet" href="/static/css/style.css?v=1789826851" type="text/css">
|
||||||
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
||||||
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||||
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
window.fetchEventSource = fetchEventSource;
|
window.fetchEventSource = fetchEventSource;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/utils.js?v=1789811377"></script>
|
<script src="/static/js/utils.js?v=1789826851"></script>
|
||||||
<script src="/static/js/ui-ham.js?v=1789811377"></script>
|
<script src="/static/js/ui-ham.js?v=1789826851"></script>
|
||||||
<script src="/static/js/geo.js?v=1789811377"></script>
|
<script src="/static/js/geo.js?v=1789826851"></script>
|
||||||
<script src="/static/js/common.js?v=1789811377"></script>
|
<script src="/static/js/common.js?v=1789826851"></script>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
||||||
<script src="/static/js/conditions.js?v=1789811377"></script>
|
<script src="/static/js/conditions.js?v=1789826851"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-conditions").addClass("active");
|
$("#nav-link-conditions").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+2
-2
@@ -113,8 +113,8 @@
|
|||||||
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789811377"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789826852"></script>
|
||||||
<script src="/static/js/map.js?v=1789811377"></script>
|
<script src="/static/js/map.js?v=1789826852"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-map").addClass("active");
|
$("#nav-link-map").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -125,8 +125,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789811377"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789826851"></script>
|
||||||
<script src="/static/js/spots.js?v=1789811377"></script>
|
<script src="/static/js/spots.js?v=1789826851"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-spots").addClass("active");
|
$("#nav-link-spots").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/status.js?v=1789811377"></script>
|
<script src="/static/js/status.js?v=1789826851"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#nav-link-status").addClass("active");
|
$("#nav-link-status").addClass("active");
|
||||||
|
|||||||
Reference in New Issue
Block a user