Open zstumgoren opened 5 years ago
@ducoquelicot So my failing memory finally returned and I realized that the glue we need for the task-running piece of the puzzle is a job scheduler. I've added details in the ticket description, so please check those out and let me know if you have questions. There are many, many schedulers out there, but the most frequently cited/recommended I found in python-land is called APScheduler (see links in ticket description). The use of a scheduler may obviate the need for a background job service such as Redis/RQ (#12), so I'd strongly recommend starting with research and integration of the scheduler before getting into Redis/RQ.
We'll need to use a job scheduler to support subscriptions, possibly in combination with an job queue such as Redis/RQ (#12).
The APScheduler python library appears to be the most common hit when googling, but it may be worth a bit more research to vet options.
There seem to be a number of SO posts detailing how to integrate APScheduler into Flask, along with a Flask-APScheduler extension which may help with integration. Apparently it's designed to play nicely with SQLAlchemy, and the integration with Flask sounds fairly straight-forward even if you decide not to use the official Flask-APscheduler extension.
The most simple version would involve firing up the scheduler when the Flask app instance is started, rather than running a long-running daemon in the background (although a daemonized service is apparently possible as well). And with the use of a database, scheduled jobs should persist across shutdown-restart cycles of the Flask application.