-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Mechanism to gracefully interrupt an ongoing Downloads.request
#255
Comments
Seems like curl_multi_remove_handle may be a way to interrupt an easy handle gracefully. The caller could probably pass an optional |
Sounds like a likely api from curl. The common way to handle it would be having downloads return a state object that you can interact with (ask progress, wait on, pause, close, etc) either as a different function or using the kwarg wait=false |
Adds a way to gracefully cancel an ongoing request. The `request` method accepts an additional `interrupt` keyword which can be a `Base.Event`. When it is triggered, the [`curl_multi_remove_handle`](https://curl.se/libcurl/c/curl_multi_remove_handle.html) is invoked, which interrupts the easy handle gracefully. It closes the `output` and `progress` channels of the `Easy` handle to unblock the waiting request task, which then terminates with a `RequestError`. Ref: JuliaLang#255
Adds a way to gracefully cancel an ongoing request. The `request` method accepts an additional `interrupt` keyword which can be a `Base.Event`. When it is triggered, the [`curl_multi_remove_handle`](https://curl.se/libcurl/c/curl_multi_remove_handle.html) is invoked, which interrupts the easy handle gracefully. It closes the `output` and `progress` channels of the `Easy` handle to unblock the waiting request task, which then terminates with a `RequestError`. Ref: JuliaLang#255
I have put up #256 with an implementation of what we discussed here. I felt that returning a state object from |
We often have APIs that stream results over a period of time. What would be a reliable way to interrupt such an ongoing
Downloads.request
?From what I gather, interrupting the julia task is not ideal. So I think this has to be done using libcurl APIs. And probably
Downloads.request
needs to provide a mechanism to signal an interruption to it somehow. Putting up this issue for discussion and resolution.The text was updated successfully, but these errors were encountered: