You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/queue.fsx
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,12 @@ sequentially and in order.
11
11
12
12
The thread processing these requests can also run a low-priority, interleaved background operation when the
13
13
queue is empty. This can be used to implicitly bring the background check of a project "up-to-date".
14
-
When the operations queue is empty this background work is run in small incremental fragments.
15
-
This work is cooperatively time-sliced to be approximately <50ms, (see `maxTimeShareMilliseconds` in
14
+
When the operations queue has been empty for 1 second ,
15
+
this background work is run in small incremental fragments. This work is cooperatively time-sliced to be approximately <50ms, (see `maxTimeShareMilliseconds` in
16
16
IncrementalBuild.fs). The project to be checked in the background is set implicitly
17
17
by calls to ``CheckFileInProject`` and ``ParseAndCheckFileInProject``.
18
18
To disable implicit background checking completely, set ``checker.ImplicitlyStartBackgroundWork`` to false.
19
+
To change the time before background work starts, set ``checker.PauseBeforeBackgroundWork`` to the required number of milliseconds.
19
20
20
21
Most calls to the FSharpChecker API enqueue an operation in the FSharpChecker compiler queue. These correspond to the
21
22
calls to EnqueueAndAwaitOpAsync in [service.fs](https://github.com/fsharp/FSharp.Compiler.Service/blob/master/src/fsharp/vs/service.fs).
Debug.WriteLine("Reactor: <-- {0}, remaining {1}, took {2}ms", desc, inbox.CurrentQueueLength, span.TotalMilliseconds)
65
-
return! loop (bgOpOpt, onComplete)
74
+
return! loop (bgOpOpt, onComplete,false)
66
75
| Some (WaitForBackgroundOpCompletion channel)->
67
76
Debug.WriteLine("Reactor: --> wait for background (debug only), remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
68
77
match bgOpOpt with
69
78
| None ->()
70
79
| Some bgOp ->while bgOp()do()
71
80
channel.Reply(())
72
-
return! loop (None, onComplete)
81
+
return! loop (None, onComplete,false)
73
82
| Some (CompleteAllQueuedOps channel)->
74
83
Debug.WriteLine("Reactor: --> stop background work and complete all queued ops, remaining {0}, mem {1}, gc2 {2}", inbox.CurrentQueueLength, GC.GetTotalMemory(false)/1000000L, GC.CollectionCount(2))
75
-
return! loop (None, Some channel)
84
+
return! loop (None, Some channel,false)
76
85
| None ->
77
86
match bgOpOpt, onComplete with
78
87
|_, Some onComplete -> onComplete.Reply()
@@ -83,13 +92,13 @@ module internal Reactor =
83
92
letspan= System.DateTime.Now - time
84
93
//if span.TotalMilliseconds > 100.0 then
85
94
Debug.WriteLine("Reactor: <-- background step, remaining {0}, took {1}ms", inbox.CurrentQueueLength, span.TotalMilliseconds)
86
-
return! loop ((if res then Some bgOp else None), onComplete)
95
+
return! loop ((if res then Some bgOp else None), onComplete,true)
87
96
| None, None -> failwith "unreachable, should have used inbox.Receive"
88
97
}
89
98
async{
90
99
whiletruedo
91
100
try
92
-
do! loop (None, None)
101
+
do! loop (None, None,false)
93
102
with e ->
94
103
Debug.Assert(false,String.Format("unexpected failure in reactor loop {0}, restarting", e))
95
104
}
@@ -138,6 +147,7 @@ module internal Reactor =
138
147
)
139
148
return! resultCell.AsyncResult
140
149
}
150
+
member__.PauseBeforeBackgroundWorkwith get()= pauseBeforeBackgroundWork andset v = pauseBeforeBackgroundWork <- v
/// dataTipSpinWaitTime limits how long we block the UI thread while a tooltip pops up next to a selected item in an IntelliSense completion list.
46
46
/// This time appears to be somewhat amortized by the time it takes the VS completion UI to actually bring up the tooltip after selecting an item in the first place.
0 commit comments