fix(site-runtime): ConfigureAwait(false) on remaining script helper awaits (review 2026-10-21 01/SR-U2)
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user