Skip to content
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

Improve cancellation #62

Open
DmitriyYukhanov opened this issue Oct 13, 2022 · 0 comments
Open

Improve cancellation #62

DmitriyYukhanov opened this issue Oct 13, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@DmitriyYukhanov
Copy link

Hey,

This one is related to #32, and I'm going to expand it a bit to a more detailed request.

It's currently not possible to cancel the download if something goes wrong and CDN does return errors making inner code throw.

But in catches, the IsCanceled flag is not checked, and it keeps trying again even if download was cancelled.

Adding if (IsCanceled) ... check before calling DownloadData.Create() could help too.

Also looks like DownloadData can't cancel and will make 3 attempts regardless.

Ideally, UpdatingContext.Runner should have a Cancel() method to cancel all internal downloaders in a currently executing step and skip not yet run steps (i.e. if it was cancelled while running Repairer, the following Updater won't even start).

Cleaning temporary data would be a great option on the top of this as well, but I believe it may deserve a dedicated feature request ticket.

Speaking of the cancellation itself, it would be great to introduce proper cancellation support through the CancellationToken while using either HttpClient async methods (it's not compatible with old Unity versions) or use IAsyncResult from the HttpWebRequest.BeginGetResponse() and similar in order to be able to immediately cancel operations.

Alternatively, cancellation could just terminate long-running tasks for the downloads.

The goal is to have 1 single API which can tell the context internals: "That's it! Let's cancel everything we do" and would immediately cancel anything happening under the hood =D

@emanzione emanzione self-assigned this Oct 17, 2022
@emanzione emanzione added the enhancement New feature or request label Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants