download icon indicating copy to clipboard operation
download copied to clipboard

Wrap download in Task.async/1 and Task.await/2

Open little-bobby-tables opened this issue 7 years ago • 6 comments

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 avatar Jul 18 '17 01:07 little-bobby-tables

@little-bobby-tables good idea!

Could you make it in one commit, please?

asiniy avatar Jul 18 '17 13:07 asiniy

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).

little-bobby-tables avatar Jul 18 '17 13:07 little-bobby-tables

Any updates on merging this? @asiniy

zacksiri avatar Jan 05 '18 10:01 zacksiri

@zacksiri I'm still waiting for it to be 1 commit. Make a new PR. 1 PR = 1 commit

asiniy avatar Jan 12 '18 09:01 asiniy

@little-bobby-tables would love to have this merged, can you squash your commit as per @asiniy 's requirement?

zacksiri avatar Mar 12 '18 09:03 zacksiri

@zacksiri do it by yourself and open another PR

asiniy avatar Mar 12 '18 13:03 asiniy