orbit-db-store icon indicating copy to clipboard operation
orbit-db-store copied to clipboard

Application throws error if it's closed during heavy replication

Open siepra opened this issue 3 years ago • 5 comments

orbit-db: 0.28.4 orbit-db-store: 4.3.3

TypeError: Cannot read properties of null (reading 'length')
    at Replicator.onReplicationProgress (...\orbit-db-store\src\Store.js:98:25)
    at onProgressCallback (...\orbit-db-store\src\Replicator.js:147:14)

Here is the demo https://github.com/siepra/closeorbitdb

Also I tried enhancing the if statement in Store.js:98 with if (this._oplog && but going further results in different error (also reachable in the sample repo I posted above)

siepra avatar May 02 '22 12:05 siepra

This is causing issues for us so it would be awesome to get a fix soon!

holmesworcester avatar May 02 '22 13:05 holmesworcester

Taking a look now

tabcat avatar May 02 '22 13:05 tabcat

For now I'll make a patch that just doesn't error when closing the store during replication - by having .close wait for currently processing replication to finish. In future versions it will be good to do things like abort ipfs block/dag calls to stop the replication more abruptly.

tabcat avatar May 02 '22 17:05 tabcat

Patched with version 0.28.5

tabcat avatar May 02 '22 18:05 tabcat

Thanks!!

holmesworcester avatar May 09 '22 15:05 holmesworcester