-
Notifications
You must be signed in to change notification settings - Fork 802
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
Cancel background work #3063
Cancel background work #3063
Conversation
src/fsharp/vs/Reactor.fs
Outdated
Trace.TraceInformation("Reactor: --> wait for background {0}.{1} ({2}), remaining {3}", bgUserOpName, bgOpName, bgOpArg, inbox.CurrentQueueLength) | ||
while bgOp ctok do | ||
Trace.TraceInformation("FCS: --> wait for background {0}.{1} ({2}), remaining {3}", bgUserOpName, bgOpName, bgOpArg, inbox.CurrentQueueLength) | ||
bgOpCts <- new CancellationTokenSource() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we dispose the old bgOpCts first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks
src/fsharp/vs/Reactor.fs
Outdated
let time = Stopwatch() | ||
time.Start() | ||
let res = bgOp ctok | ||
bgOpCts <- new CancellationTokenSource() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -10,7 +10,7 @@ open OptionsUIHelpers | |||
|
|||
module DefaultTuning = | |||
let SemanticColorizationInitialDelay = 0 (* milliseconds *) | |||
let UnusedDeclarationsAnalyzerInitialDelay = 1000 (* milliseconds *) | |||
let UnusedDeclarationsAnalyzerInitialDelay = 0 (* milliseconds *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think this is ok.
A quick update on this: I've been trying to use this in practice to get a sense if the cancellation makes for a better overall experience - for example I'm vaguely concerned there might be situations where the background builder never really makes progress because so many requests are coming in to FCS from things like the "SimplifyName" code fix. I'll keep using it myself and keep an eye on things. |
This is now ready |
For the record, @KevinRansom asked me why I was originally hesitant about this PR. My reply:
|
This is a WIP PR to extend #3061.
In #3061 I noticed that therre we some long running, non-cancellable operations on the background thread. This means, for example, that if you
then there will be no intellisense or colorization in the script until the basic preparation of project P (and possibly the complete checking of its dependencies) is finished
This PR cancels background work when new foreground work arrives that will implicitly start replacement background work (e.g. to prepare a script).