planetary-ios icon indicating copy to clipboard operation
planetary-ios copied to clipboard

BUG: Published blobs take too long to propagate

Open mplorentz opened this issue 2 years ago • 3 comments

Other clients apparently push blobs out to connected peers as soon as they are published. Planetary doesn't do this, meaning a peer has to request your blob while you are online or it won't propagate.

From andrestaltz (%2s32sWdS14QUKXECTGmwSjTN9fost9eV6TdedsCcSvc=.sha256):

We don’t do anything different in Manyverse in comparison to (say) Patchwork. The plugin we use is ssb-blobs, and I think one important part of that subprotocol is to “push” the blobs to peers connected, not just make it available for “pull”, which is the request thing you mentioned.

mplorentz avatar Jan 31 '22 16:01 mplorentz

Possibly related to https://github.com/planetary-social/viewer/issues/21.

boreq avatar Mar 07 '22 18:03 boreq

Trigger it from swift to call muxrpc call to push blobs to peers.

@boreq will write function which is 'push x blob to peers' @mplorentz will write a function in swift to call the push method.

rabble avatar May 10 '22 20:05 rabble

I did some research on this this morning and found some good stuff.

  • The README for the ssb-blobs Node.js plugin has some docs for a blobs.push function that does what we want. The code is hard to read but I was able to make some sense of it eventually. Basically after you publish a blob you emit a "want" message for the very same blob to peers, who then publish their own "sympathetic want" for the same blob, which results in them downloading the blob from you.
  • the node implementation keeps wants in the db so they persist past restarts, and keeps track of how many peers have requested your own blob from you so eventually you stop wanting it.
  • go-ssb's blobstore has a WantWithDist() function that allows you to publish arbitrary wants. I added a call to this function every time the user adds a blob in #626. It doesn't work 100% of the time, but it's better than not doing it at all.

I think with this knowledge we could probably make go-ssb's blobstore emulate the node.js store by storing wants on disk and keeping track of how many times a blob has been requested from us. It would be better to do this in the go layer, but I could do it in Swift too if we need to save time. This would be a great feature to contribute to upstream go-ssb too.

mplorentz avatar Jun 13 '22 15:06 mplorentz

doneish.

rabble avatar Aug 19 '22 00:08 rabble