richard-webb-dev / werewolves-site

Small early stages project of a simple part game
0 stars 0 forks source link

Changes to redis are not atomic #24

Closed richard-webb-dev closed 8 years ago

richard-webb-dev commented 8 years ago

This only becomes an issue with data that can be modified from multiple sources simultaneously, which should actually be pretty unlikely in a turn based game (until it's the hidden, complex bug after 6 months of coding...). Scenarios where this comes into play would currently be limited to player's joining/leaving.

Worth being aware of though for future features.

See https://github.com/SPSCommerce/redlock-py and http://redis.io/topics/distlock for guidelines.

Inspired by #11.

richard-webb-dev commented 8 years ago

this will be closed when #11 is solved

richard-webb-dev commented 8 years ago

Still a potential issue despite fixing #11. One way to help reduce the chance of conflicts is to filter what is saved in Class.save() functions.

Alternatively or additionally, you could flag a record (simulating a lock) and add a delay/callback if the lock is held by someone else.

On top of this, you could checkout a copy before your commit, then compare the current status to before and after your commit, and attempt to merge any conflicts (or at least error loudly)

Very low priority as far as I'm concerned!