keichan34 / exfile-b2

A Backblaze B2 backend for Exfile
MIT License
8 stars 2 forks source link

Make `exfile-b2` working with async HTTPoison response #3

Open asiniy opened 8 years ago

asiniy commented 8 years ago

As I understood this library correctly, it's working in this chain:

  1. Get download url
  2. Download file to the server
  3. Send file to the user

The problem is, if the file is too big, it's kinda long to wait for the response. Best solution here, in my mind, is to use httpoison async response ability. Idea is slightly complicate alghorhythm to make it working significanlty faster:

  1. Get download url
  2. Start async request
  3. On receiving headers start to response
  4. On receiving headers start to write file to LocalCache.

WDYT?

keichan34 commented 8 years ago

Interesting. I can see how this can help, especially with big files like videos. My concern is that processors don't support streaming right now, so this would only work if there are no processors in the pipeline -- that is probably an acceptable compromise until a good asynchronous streaming processor API can be implemented.

asiniy commented 8 years ago

@keichan34 by the way I found b2 problems with sending big files to us - videos aren't playing correctly and downloading in the small speed. Have you experienced this behaviour?

keichan34 commented 8 years ago

I haven't, but most of my files are anywhere between 1 and 15 MB -- are your files a lot bigger than that?

asiniy commented 8 years ago

Yeah.