chairemobilite / transition

Transition is a modern new approach to transit planning. It's a web application to model, simulate and plan public transit and alternative transportation.
http://transition.city
MIT License
20 stars 13 forks source link

db: Allow all queries to receive a transaction parameter #936

Closed tahini closed 1 month ago

tahini commented 1 month ago

Also make sure individual operations that span many tables (like scenarios and schedules) are all inside transactions to avoid errors while saving those object to leave the object is an intermediate, unknown, state.

While doing so, to make transactions as fast and short as possible, the queries that involved reading/processing/writing now try to do it in a single database query, or favor batch inserts/updates/deletes.

greenscientist commented 1 month ago

@kaligrafy, did you really review this ? Seem quick to take 4 minutes to review 24 files that affect how we interract with the database...

tahini commented 1 month ago

Tested with sequential tests and transition (gtfs import and calculations)

kaligrafy commented 1 month ago

I did review, but i did not test

tahini commented 1 month ago

@greenscientist I added tons of comments and used nested function whenever it made more sense scope-wise than private functions.

tahini commented 1 month ago

Nested functions, when used judiciously, is a quite powerful feature of javascript! But apparently people coming from C/C++ don't like them... :p

All this and I'm not even closing an issue!