From 29e4ff27a2ae5d604dfd33a52663ce69c2414255 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Thu, 7 Mar 2024 17:12:16 -0500 Subject: [PATCH] Put aval to asyncaval compute on threadpool This fixes issues where long running aval.GetChanges would potentially cause threadpool exhaustion. --- src/FsAutoComplete.Core/AdaptiveExtensions.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FsAutoComplete.Core/AdaptiveExtensions.fs b/src/FsAutoComplete.Core/AdaptiveExtensions.fs index 60d4c503b..96b49c766 100644 --- a/src/FsAutoComplete.Core/AdaptiveExtensions.fs +++ b/src/FsAutoComplete.Core/AdaptiveExtensions.fs @@ -589,7 +589,7 @@ module AsyncAVal = else { new AbstractVal<'a>() with member x.Compute t = - let real = Task.FromResult(value.GetValue t) + let real = Task.Run(fun () -> value.GetValue t) AdaptiveCancellableTask(id, real) } :> asyncaval<_>