peerbit
peerbit copied to clipboard
OPFS persistance with multiple tabs, prevent lock issues
trafficstars
Current solution for persistance in the browser is to use OPFS for block and indexing store. This works well when only one tab is used, but when multiple tabs want to access the same file we will run into problems because accessHandles can only be accessed by one tab at once.
Possible solution.
Make one tab "parent" and the other ones "children".
When parent tab closed down, make one of the children the parent. All requests from the parent are done directly to the OPFS worker, while the other will broadcast a request to the other parent.
Is this still an issue if Peerbit itself is run in a shared worker?