[+] Added task scheduler

This commit is contained in:
Charles Le Maux 2024-09-06 12:43:28 +02:00
parent 7ff1d726cc
commit 6fd8cf73e6

4
app.py
View File

@ -1,6 +1,7 @@
import http import http
import inspect import inspect
from typing import Union from typing import Union
from apscheduler.schedulers.background import BackgroundScheduler
from flask import (Blueprint, Flask, Response, jsonify, request) from flask import (Blueprint, Flask, Response, jsonify, request)
from flask_cors import CORS from flask_cors import CORS
@ -125,4 +126,7 @@ app.register_blueprint(apiBP)
if __name__ == '__main__': if __name__ == '__main__':
atexit.register(exit_safety) atexit.register(exit_safety)
scheduler = BackgroundScheduler()
scheduler.add_job(generic_executor.scheduled_actions, 'interval', minutes=1)
scheduler.start()
app.run(host='0.0.0.0', port=3000, debug=False) app.run(host='0.0.0.0', port=3000, debug=False)