Closed ineshbose closed 4 years ago
Dictionary calendar
is very very inconsistent causing loss of calendar mid-use.
Unable to re-login, the calendar can't be fetched.
Problem found:
os.getpid()
gives different output on Heroku which means that processes are switching and so data is lost between the processes.
Possible solutions:
multiprocessing
: Not supported by Gunicorn workers. In this case, again, probably not desirable either.pipes
?Two solutions:
Procfile
: add a --workers 1
between web: gunicorn
and run:app
. This method, however, won't be great for large-scale use.redis
/caching: Implement a redis
database ONLY in timetable.py
that clears and sets in __init__()
everytime.Refer: https://stackoverflow.com/questions/62328835/why-my-flask-backend-is-unstable-on-heroku
ISSUE DEBRIEF:
Since this feature can be disabled, it's the developer's choice and responsibility to use it in the best way possible. Therefore, either they disable the feature, or ensure that the app uses one process/worker when deployed.
For now, the issue is closed.
Enable users to use the bot and not have their University ID & Password stored in the database, but to fetch the calendar once.
This will require a
BooleanField
inRegisterForm
with label "Remember me" (default=True
) and just store their sender ID in the database for getting to the gateway.However, this feature may be unstable since the once-fetched calendar may get lost (a small chance).