looking at scheduler

This commit is contained in:
Lucas Mathews
2024-05-29 22:44:19 +02:00
parent c2812aa2c4
commit 558d818aac
4 changed files with 38 additions and 5 deletions

26
scheduler.py Normal file
View File

@@ -0,0 +1,26 @@
# Lucas Mathews - Fontys Student ID: 5023572
# Banking System Scheduler
import schedule
from manager import log_event
def run_schedule():
while True:
schedule.run_pending()
#################
### Functions ###
#################
def clean_otp():
"""Cleans the OTP table."""
from manager import clean_expired_otps
removed_otps = clean_expired_otps()
log_event(f"Removed {removed_otps} expired OTPs.")
#################
### Schedules ###
#################
schedule.every(2).seconds.do(clean_otp)