fix(site-runtime): ConfigureAwait(false) on remaining script helper awaits (review 2026-10-21 01/SR-U2)

This commit is contained in:
Joseph Doherty
2026-10-22 08:31:56 -04:00
parent 4ff26a0614
commit 010d2ea438
4 changed files with 35 additions and 12 deletions
@@ -254,4 +254,24 @@ public class AlarmsAccessorTests : TestKit, IDisposable
Assert.Single(await pending);
}
/// <summary>
/// The helper's continuation must not capture the script scheduler: a script that blocks its
/// only worker on the task (<c>.Wait()</c>) still completes (review 2026-10-21 01/SR-U2).
/// </summary>
[Fact]
public async Task CurrentAsync_ContinuationDoesNotNeedTheScriptScheduler_BlockingWaitCompletes()
{
using var scheduler = new ScriptExecutionScheduler(1);
var probe = CreateTestProbe();
var ctx = MakeContext(probe.Ref);
var run = Task.Factory.StartNew(
() => ctx.Alarms.CurrentAsync().Wait(TimeSpan.FromSeconds(10)),
CancellationToken.None, TaskCreationOptions.None, scheduler);
RespondWith(probe);
Assert.True(await run.WaitAsync(TimeSpan.FromSeconds(15)), "CurrentAsync continuation was queued back onto the blocked script scheduler");
}
}