orbitdb-archive / orbit-db-store

Base class for orbit-db data stores
MIT License
40 stars 22 forks source link

Application throws error if it's closed during heavy replication #121

Open siepra opened 2 years ago

siepra commented 2 years ago

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)

holmesworcester commented 2 years ago

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

tabcat commented 2 years ago

Taking a look now

tabcat commented 2 years ago

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 commented 2 years ago

Patched with version 0.28.5

holmesworcester commented 2 years ago

Thanks!!