feat: Add status check speedups
All checks were successful
Build Docker / BuildImage (push) Successful in 59s

This commit is contained in:
2025-06-13 23:43:41 +10:00
parent bbc3801a41
commit f936973b8d
3 changed files with 473 additions and 231 deletions

12
main.py
View File

@@ -1,13 +1,13 @@
import time
import signal
import threading
import concurrent.futures
from flask import Flask
from server import app
from server import app, node_check_executor
import server
from gunicorn.app.base import BaseApplication
import os
import dotenv
import concurrent.futures
import schedule
@@ -58,6 +58,10 @@ def run_gunicorn():
def signal_handler(sig, frame):
print("Shutting down gracefully...", flush=True)
stop_event.set()
# Shutdown the node check executor
print("Shutting down thread pools...", flush=True)
node_check_executor.shutdown(wait=False)
if __name__ == '__main__':
@@ -79,6 +83,10 @@ if __name__ == '__main__':
finally:
stop_event.set()
scheduler_future.cancel()
# Make sure to shut down node check executor
node_check_executor.shutdown(wait=False)
try:
scheduler_future.result(timeout=5)
except concurrent.futures.CancelledError: