ChluNetwork / chlu-ipfs-support

Support libs to talk to IPFS
MIT License
1 stars 1 forks source link

Make OrbitDB Index aware of the review record content to allow proper indexing #96

Closed fazo96 closed 6 years ago

fazo96 commented 6 years ago

From Slack:

indexing reviews by DID works, but with a shortcut

The problem is that OrbitDB is not aware of the review content, only its multihash. This was ok before because we did not index them by some field they contained.

The shortcut is to copy the info we need in the orbitdb payload like this: { multihash, didId } but this is dirty and escapes validation.

Eventually, we'll have to get the async updateIndex function (the one that takes orbit-db operations and applies them to the index) to read the review record, verify if it's valid, etc. I could do that, but what happens if readReviewRecord hangs indefinitely because now some IPFS block can't be fetched? The Chlu process grinds to a halt and no update enter the db anymore, they just get queued forever

Obviously we don't want this, but if we put a timeout to readReviewRecord we have no chance to eventually recover data that at the original moment of the read was not available unless we implement some kind of try again system (edited)

A nice idea would be not indexing the RR immediately using the did Id, but start a background task that does it, so that orbit-db updateIndex doesn't get stuck. also, we are already using this shortcut to get updating reviews to work. If we fix it for DIDs, we fix it for every other need. We also are forced to fix the shortcut if we want the ChluDB (external database for chlu data) to ever work

The good news: we can fix it while it's live, so it's not blocking