ssbc / ssb-ooo

retrive ssb messages Out Of Order
MIT License
14 stars 4 forks source link

`ssb-ooo` saves multiple copies of the same message to the `ooo` flumelog #1

Open evbogue opened 6 years ago

evbogue commented 6 years ago

I was playing around with using ssb-ooo in http://github.com/evbogue/mvd and I discovered that ooo.get will make a network request for a message, even after it's been saved to .ssb/ooo/log.offset. Then ooo will save a duplicate message, even if it already has the message in the log.

It seems to me that it shouldn't be requesting the message from the network, if it already has it.

My idea for mvd is to start with lower initial hops, and then use votes to request and show ooo reblogs. This way initial sync will be faster, and discovery will be more fun because you'll find people by following and then exploring via reblogs.

dominictarr commented 6 years ago

hmm, that is definitely a bug.

that shouldn't be happening, though, because it get found by store.get, and not do the request. https://github.com/dominictarr/ssb-ooo/blob/master/index.js#L45-L53

hmm, I think the problem is here: https://github.com/dominictarr/ssb-ooo/blob/master/index.js#L65-L71 it always calls store.add after gq.query, but sometimes gq.query's response will already be coming from the store... I guess gq.query needs a way to tell the caller if it came from the network or the cache, and only add if it came from the network.