kopia lustrzana https://github.com/projecthorus/radiosonde_auto_rx
Hopefully fix issues with werkzeug not allowing auto_rx to exit. Handle SDR exceptions within scan loop on non-linux systems
rodzic
2134bab6fb
commit
658dec26fe
|
@ -865,12 +865,16 @@ class SondeScanner(object):
|
|||
self.log_warning("SDR produced no output... resetting and retrying.")
|
||||
self.error_retries += 1
|
||||
# Attempt to reset the SDR, if possible.
|
||||
reset_sdr(
|
||||
self.sdr_type,
|
||||
rtl_device_idx = self.rtl_device_idx,
|
||||
sdr_hostname = self.sdr_hostname,
|
||||
sdr_port = self.sdr_port
|
||||
)
|
||||
try:
|
||||
reset_sdr(
|
||||
self.sdr_type,
|
||||
rtl_device_idx = self.rtl_device_idx,
|
||||
sdr_hostname = self.sdr_hostname,
|
||||
sdr_port = self.sdr_port
|
||||
)
|
||||
except Exception as e:
|
||||
self.log_error(f"Caught error when trying to reset SDR - {str(e)}")
|
||||
|
||||
for _ in range(10):
|
||||
if not self.sonde_scanner_running:
|
||||
break
|
||||
|
|
|
@ -290,7 +290,11 @@ def shutdown_flask(shutdown_key):
|
|||
global flask_shutdown_key
|
||||
# Only shutdown if the supplied key matches our shutdown key
|
||||
if shutdown_key == flask_shutdown_key:
|
||||
flask.request.environ.get("werkzeug.server.shutdown")()
|
||||
shutdown_function = flask.request.environ.get("werkzeug.server.shutdown")
|
||||
if shutdown_function:
|
||||
shutdown_function()
|
||||
else:
|
||||
logging.debug("Unable to stop this version of Werkzeug, continuing...")
|
||||
|
||||
return ""
|
||||
|
||||
|
@ -586,6 +590,8 @@ def start_flask(host="0.0.0.0", port=5000):
|
|||
|
||||
# Start up Flask
|
||||
flask_app_thread = Thread(target=flask_thread, kwargs={"host": host, "port": port})
|
||||
# Set thread to be a daemon, so python will quit nicely.
|
||||
flask_app_thread.daemon = True
|
||||
flask_app_thread.start()
|
||||
logging.info("Started Flask server on http://%s:%d" % (host, port))
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue