Closed tanmaykm closed 1 month ago
It looks like the Downloads code normally provides 2 APIs for this. One difficult option is to call done!
on the Easy object handle inside Downloads. It is very difficult to access this object, either via an easy_hook
or progress
callback:
downloader = Downloads.Downloader()
downloader.easy_hook = (easy, info) -> global current_download = easy
Or an easy option is to call close(output)
, which will automatically trigger the safe destruction of the download object the next time any output is received (or if the timeout is reached or other error occurs)
Yeah, but this feels inadequate... can't think of a good way to have parallel requests and keep track of the easy handle without Downloads.jl exposing some nicer way to do that.
I have put up https://github.com/JuliaLang/Downloads.jl/pull/256 with a solution that we discussed for https://github.com/JuliaLang/Downloads.jl/issues/255. We can probably switch to something like that once it is available?
Interrupting the download task by scheduling an InterruptException on to it, like what we do here is not a good idea. It can lead to data race conditions and corruption.
We need to replace it with something that is safe. Ref https://github.com/JuliaLang/Downloads.jl/issues/255