Open elthran opened 7 years ago
This turns out to be a fairly complex problem. https://devcenter.heroku.com/articles/background-jobs-queueing (general)
https://flask-rq2.readthedocs.io/en/latest/ (specific and perfect for us I think)
Also there is something called Celery http://flask.pocoo.org/docs/0.12/patterns/celery/
None of those work on PythonAnywhere which is laaaamee. This might help. https://help.pythonanywhere.com/pages/LongRunningTasks Or just having a simple scheduled task? (in pythonanywhere) .. have it run a file with a new database session with so failure proofing ... like save after each hero update and ignore any hero that has been updated recently.
Maybe Redis? or something related to it? https://redislabs.com/resources/how-to-redis-enterprise/#using-redis-with-python
I am trying to figure out how to enable background tasks with flask integration on PythonAnywhere .. (the last is the hard part).
(after seeing that @elthran assigned it to me) Lol. Ok. I will see what I can do. Getting it on the PythonAnywhere server will be the real pain.
https://github.com/elthran/RPG-Game/tree/time_update ... needs more work to be ready for the server ... and doesn't work with 'app.run(debug=True)'.
I think I might need to build a wrapper class for the Flask object. .. and do something fancy :P
Line 357 of database.py has function update_time(self, hero)
I want to redesign this. It should update for all heroes periodically? And the values need to be based on properties of each hero.