Closed jviotti closed 4 years ago
@jviotti I think this would be a great addition to the project.
@Slapbox I think the main problem with this is that you could get into update conflicts if two entities are trying to write to the same key. Each of them may re-read what they wrote, just to find that the other entity over-wrote it already (this is coming up in the test failures).
Maybe we can add it, but as an opt-in feature behind an option flag?
@Slapbox I added it behind a validate: true
option in .set()
Landed in v4.2.0
@jviotti thanks for the crazy fast reply and merge!
That makes a lot of sense regarding possible interference between two atomic write attempts to the same key. I didn't look closely enough at the PR to realize it's checking for equality rather than just a non-zero size. Looks good though!
See: https://github.com/electron-userland/electron-json-storage/issues/123