Did not move to Gunicorn, but now working in Docker

This commit is contained in:
Lucas Mathews
2024-06-15 20:49:18 +02:00
parent 1c614f23b6
commit 15c0d62523
5 changed files with 13 additions and 20 deletions

View File

@@ -15,19 +15,15 @@ def run_schedule():
def clean_otp():
"""Cleans the OTP table."""
event_logger("Starting to clean OTPs...")
print("Cleaning OTPs...")
from manager import clean_expired_otps
removed_otps = clean_expired_otps()
event_logger(f"Removed {removed_otps} expired OTPs.")
event_logger("Finished cleaning OTPs.")
schedule.every(300).seconds.do(clean_otp)
thread = threading.Thread(target=run_schedule)
thread.daemon = True # Set the thread as a daemon thread
thread.start()
try:
while True: # Keep the main program running
time.sleep(1)
except KeyboardInterrupt:
stop_event.set() # Signal the thread to stop