How is this implementation supposed to handle concurrent accesses?
The only time the db file is read is during the constructor, so whenever two or more clients instanciate the class at roughly the same time, all edits performed by the other clients will be overwritten by the one who commits their changes the last.
Is this intended behavior? Imho the json file must be reloaded/parsed and merged with db's contents in locked fashion before every write that's being performed. Otherwise you'll quickly lose changes when multiple clients access the same db file.
I think that is a valid comment, that the nice and small DB here does not really handle currently, right?
Maybe some "locking" could be implemented to prevent that?
How is this implementation supposed to handle concurrent accesses?
The only time the db file is read is during the constructor, so whenever two or more clients instanciate the class at roughly the same time, all edits performed by the other clients will be overwritten by the one who commits their changes the last.
Is this intended behavior? Imho the json file must be reloaded/parsed and merged with db's contents in locked fashion before every write that's being performed. Otherwise you'll quickly lose changes when multiple clients access the same db file.
Please clarify. Thanks.