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

Allow the user to cancel long operations #468

Open
1 of 6 tasks
Ortham opened this issue Jul 18, 2015 · 1 comment
Open
1 of 6 tasks

Allow the user to cancel long operations #468

Ortham opened this issue Jul 18, 2015 · 1 comment

Comments

@Ortham
Copy link
Member

Ortham commented Jul 18, 2015

Suggested by pStyl3, and I certainly wished I had one when testing masterlist parsing failures yesterday. To support this:

  • Create a framework for cancelling JS<->C++ queries, using cefQueryCancel()
  • Ensure each cancellable operation is transactional, probably the easiest way to do this is by not modifying the LOOT state object until the end of the operation.
  • Add cancellation points at logical points in each cancellable operation.

The following operations would be affected:

  • Changing game
  • Masterlist update
  • Plugin sorting
  • Content refresh
  • Conflicting plugins filtering

These processes would have to be adapted to ensure that early exit doesn't result in partial changes being made, unless such changes wouldn't have an adverse effect (for example, only fully-loading some plugins would be OK).

@Ortham Ortham modified the milestone: v0.9.0 Dec 12, 2015
@Ortham Ortham modified the milestones: v0.9.0, v0.10.0 May 30, 2016
@Ortham
Copy link
Member Author

Ortham commented Aug 29, 2016

I've finally started working on this.

Unfortunately, cancelling a query is a little messy because although notifying the C++ side is easy enough, a callback can't be called for a cancelled query, so the query's promise never settles. To make matters worse, ES2015 promises can't have their state changed externally, so the JS query cancel function can't just reject the query's promise.

To get around this, I check a cancelled boolean once a second while the promise is pending, and reject the promise an undefined reason if the boolean is true. The boolean is initialised to false and set to true by the query cancel function. The promise rejection handler has been updated to not display an error if the reason is undefined.

@Ortham Ortham modified the milestone: v0.10.0 Oct 8, 2016
@Ortham Ortham modified the milestone: v0.11.0 Nov 6, 2016
@Ortham Ortham removed this from the v0.11.0 milestone Apr 9, 2017
@sibir-ine sibir-ine added the ui label Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants