Need a lock to manipulate items array

Issue #34 new
零欸特 created an issue

Imagine archiving item A and item B in the popup at the same time. The app retrieves 2 identical items

https://bitbucket.org/pabuisson/in-my-pocket/src/1ecd5c3497ad715de160e631498eb884b959b6d8/src/modules/items.js#lines-47

After processing the request, items end up with either A is removed or B is removed. Ideally, A and B should both be removed.

Comments (2)

  1. JJ

    Naive lock and busy waiting would probably work in most cases, though I’d advocate to move whole storage to IndexedDB or AbsurdSQL and target specific records directly in database, that would entirely prevent collisions (situations when multiple copies of storage are modified simultaneously and written on top of each other resulting in missing changes)

  2. 零欸特 reporter

    +1

    Have a key-value store (indexedDB) will be way better than the current (a flat array).

  3. Log in to comment