download
download copied to clipboard
Wrap download in Task.async/1 and Task.await/2
The receive
block used to communicate between the response receiving process and the parent intercepts all messages directed to the parent. This prevents Download
from being used in Phoenix apps (see the commit message) and may introduce other hard-to-track bugs.
I think Task
with its straightforward API is a good replacement for manual process spawning. It also allows us to specify the timeout for the entire download operation, which is important when the URL is taken from user input.
This PR is a follow-up to #2, it'd be nice if you could review that first. I also understand that you're busy at the moment; this can wait for as long as you need.
@little-bobby-tables good idea!
Could you make it in one commit, please?
Sure, but I think it'd be better if #2 got merged first so I can properly rebase this branch. #2 is needed because it adds a feature required by these changes (namely, a local server to test edge cases like timeouts).
Any updates on merging this? @asiniy
@zacksiri I'm still waiting for it to be 1 commit. Make a new PR. 1 PR = 1 commit
@little-bobby-tables would love to have this merged, can you squash your commit as per @asiniy 's requirement?
@zacksiri do it by yourself and open another PR