testsys / ball

Balloon manager
2 stars 2 forks source link

Locks #4

Closed jpsbur closed 6 years ago

jpsbur commented 8 years ago

DB locks (or at least checks) required Probably should switch to some other solution than mysql.

jpsbur commented 7 years ago

First step: make changes idempotent. Pass source state in request along with destination state.

burunduk3 commented 6 years ago

As I know, pymysql and cymysql use autocommit=False by default, so every database connection is a separate transaction. We'll need commit after every page generation (now only for database updates) if we'll make database connection persist (now connection is closed after every page generation).

Other thing: we have to mark select queries with FOR UPDATE if we'll make further changes based on query result (for example, do not change state of balloon if it is already taken by other volunteer). Commit e1596623853a053c727daefeb0468e66bba94671 adds this in update.py.

burunduk3 commented 6 years ago

Commit a21256f7d0a16e7324547dee65b59a286bdccf1e adds check in only critical modification: taking the balloon.