@@ -98,9 +98,9 @@ type DummyTaskFactory(µsecMin: int64<µs>, µsecMax: int64<µs>) =
9898 /// Creates dummy tasks with a randomized delay and a mutable state,
9999 /// to ensure we properly test whether processing is done ordered or not.
100100 /// Uses the defaults for <paramref name =" µsecMin " /> and <paramref name =" µsecMax " />
101- /// with 10 ,000µs and 30 ,000µs respectively (or 10ms and 30ms ).
101+ /// with 1 ,000µs and 5 ,000µs respectively (or 1ms and 5ms ).
102102 /// </summary >
103- new () = DummyTaskFactory( 10_000 L < µs>, 30_000 L < µs>)
103+ new () = DummyTaskFactory( 1_000 L < µs>, 5_000 L < µs>)
104104
105105 /// <summary >
106106 /// Creates dummy tasks with a randomized delay and a mutable state,
@@ -164,8 +164,9 @@ module TestUtils =
164164 >> TaskSeq.toArrayAsync
165165 >> Task.map ( String >> should equal expected)
166166
167- /// Delays (no spin-wait!) between 20 and 70ms, assuming a 15.6ms resolution clock
168- let longDelay () = task { do ! Task.Delay( Random() .Next( 20 , 70 )) }
167+ /// Waits using a real timer-based async delay (not spin-wait), causing an OS-level async yield point.
168+ /// On Windows, Task.Delay has ~ 15ms timer resolution, so this actually waits ~ 15ms.
169+ let longDelay () = task { do ! Task.Delay 1 }
169170
170171 /// Spin-waits, occasionally normal delay, between 50µs - 18,000µs
171172 let microDelay () = task { do ! DelayHelper.delayTask 50 L< µs> 18_000 L< µs> ( fun _ -> ()) }
@@ -324,8 +325,8 @@ module TestUtils =
324325 yield x
325326 }
326327
327- /// Create a bunch of dummy tasks, each lasting between 10-30ms with spin-wait delays.
328- let sideEffectTaskSeq = sideEffectTaskSeqMicro 10_000 L < µs> 30_000 L < µs>
328+ /// Create a bunch of dummy tasks, each lasting between 1-5ms with spin-wait delays.
329+ let sideEffectTaskSeq = sideEffectTaskSeqMicro 1_000 L < µs> 5_000 L < µs>
329330
330331 /// Returns any of a set of variants that each create an empty sequence in a creative way.
331332 /// Please extend this with more cases.
@@ -428,7 +429,7 @@ module TestUtils =
428429 | SeqImmutable.AsyncYielded ->
429430 // by returning the 'side effect seq' from the closure of the CE,
430431 // the side-effect will NOT execute again
431- taskSeq { yield ! sideEffectTaskSeqMicro 15_000 L < µs> 50_000 L < µs> 10 }
432+ taskSeq { yield ! sideEffectTaskSeqMicro 1_000 L < µs> 5_000 L < µs> 10 }
432433 | SeqImmutable.AsyncYielded_ Nested ->
433434 // let's deeply nest the sequence, which should not cause extra side effects being executed.
434435 taskSeq {
@@ -442,7 +443,7 @@ module TestUtils =
442443 yield ! taskSeq {
443444 // by returning the 'side effect seq' from the closure of the CE,
444445 // the side-effect will NOT execute again
445- yield ! sideEffectTaskSeqMicro 15_000 L < µs> 50_000 L < µs> 10
446+ yield ! sideEffectTaskSeqMicro 1_000 L < µs> 5_000 L < µs> 10
446447 }
447448 }
448449 }
@@ -520,12 +521,12 @@ module TestUtils =
520521
521522 // delay just enough with a spin-wait to occasionally cause a thread-yield
522523 | SeqWithSideEffect.ThreadSpinWait -> sideEffectTaskSeqMicro 50 L< µs> 5_000 L< µs> 10
523- | SeqWithSideEffect.AsyncYielded -> sideEffectTaskSeqMicro 15_000 L < µs> 50_000 L < µs> 10
524+ | SeqWithSideEffect.AsyncYielded -> sideEffectTaskSeqMicro 1_000 L < µs> 5_000 L < µs> 10
524525 | SeqWithSideEffect.AsyncYielded_ Nested ->
525526 // let's deeply nest the sequence, which should not cause extra side effects being executed.
526527 // NOTE: this list of tasks must be defined OUTSIDE the scope, otherwise, mutability on 2nd
527528 // iteration will not kick in!
528- let nestedTaskSeq = sideEffectTaskSeqMicro 15_000 L < µs> 50_000 L < µs> 10
529+ let nestedTaskSeq = sideEffectTaskSeqMicro 1_000 L < µs> 5_000 L < µs> 10
529530
530531 taskSeq {
531532 yield ! taskSeq {
0 commit comments