feat: ensure periodic data updates for app stability

Added instructions to README for regularly triggering `/cron/` to keep the app's cached data updated. Modified `main.py` to initialize `global_ibles` even when using a WSGI server, ensuring data consistency. This change improves the reliability and performance of the app by maintaining up-to-date data.

Relates to #9
This commit is contained in:
Kumi 2024-10-02 11:54:03 +02:00
parent 8356f71fc1
commit ef0c0a5e89
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 5 additions and 0 deletions

View file

@ -36,6 +36,7 @@ Of course, you can also join our [Matrix room](https://matrix.pcof.fi/#/#structa
4. Run `uwsgi --plugin python3 --http-socket 0.0.0.0:8002 --module structables.main:app --processes 4 --threads 4`
5. Point your reverse proxy to http://localhost:8002 and (optionally) serve static files from the `venv/lib/pythonX.XX/site-packages/structables/static` directory
6. Connect to your instance under your domain
7. Ensure that `/cron/` is executed at regular intervals so that the app updates its cached data.
### Production: Docker
@ -49,6 +50,7 @@ Of course, you can also join our [Matrix room](https://matrix.pcof.fi/#/#structa
4. Point your reverse proxy to http://127.0.0.1:8002 (or your chosen port, if you modified it) and (optionally) serve static files from `structables/static`
5. Connect to your instance under your domain
6. Ensure that `/cron/` is executed at regular intervals so that the app updates its cached data.
### Development

View file

@ -40,3 +40,6 @@ def main():
if __name__ == "__main__":
main()
else:
# Even if we're using a wsgi server, we still have to initialize global_ibles
update_data(app)