Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a Blob server for getting teh blobs #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pietgeursen
Copy link
Member

Adds a really basic http server for getting blobs

It does actually work on the app, I've seen images in posts now which is 🍰 🎉 🎈

@cryptix at some point we talked about being able to make an async version of the blobstore.Get function. I can't remember if it was hard or not. If it's easy, how to do it?

@cryptix
Copy link
Collaborator

cryptix commented Dec 22, 2019

async in which sense? They it waits until the blob is received?

There is a event-emitter like system on the blobstore that can be used for this but it needs to be wired up by hand right now.

Do you use the http sever just to inject the blobs.want call? Ok, the markdown render seems to need this?

this way the error is swallowed if the listen fails
using BlobsGet() bufferes a lot of data on the go sidem, which is
supposed to be passed across the language barrier.

Internally we don't want to copy all that into RAM, this uses the reader
from blobs.Get and copys it into the http response directly without
buffering.

The blobstore.Changes() observable is hooked into to wait if the blob
isn't available yet.
@cryptix
Copy link
Collaborator

cryptix commented Dec 22, 2019

i made some polish and also fixed the imports since you did the github move (did not update the deps though and also commited a patch with the diffs from upstream on go-ssb)

this should work and wait for the blob, for 30 seconds at least.

}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to add some Content-Length or mime types here but it should still work.

need to close the listener if we want to restart the bot
@cryptix
Copy link
Collaborator

cryptix commented Dec 22, 2019

a92fb43 takes care of ssbc/go-ssb#30 and fixes the formatting of the error that came up in sunrise-choir/sunrise-social-android-app#2 (comment)

27651c8 makes sure the listener for the http server is freed in botStop() so that the bot can restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants