I am building a Travian clone for learning purposes using FastAPI for the backend. I want to update my curent logged user tables whenever he is making a new request (such as loading a new page) unlike updating tables every x seconds.
Since I am using FastAPI, I found that a middleware could be a good option to update tables for every new http request. However, there is a lot of tables that may be updated:
- Ressources (always)
- Ingoing attacks
- Outgoing attacks
- Building / Upgrading buildings
- Building / Upgrading troops ...
What would be the best approach to update my tables for every new http request? Updating every tables may be a bit more time-consuming but probably easier to manage
Thi is related to question 1, but since I chose to update my tables on every call, I must store somewhere a timestamp of a column
last_updated_timestampin order to calculate the new value. Should I create this column for every tables that is re-calculated or should I hold a singlelast_updated_timestampvalue for every table?