test(decode): wait for the read-ahead before the demand loads that must meet it (#15)
CI / Build and test (push) Successful in 8m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
CI / PostgreSQL 16 integration (push) Successful in 11m22s
CI / PostgreSQL 17 integration (push) Successful in 11m38s
CI / Docker image (push) Successful in 54s
CI / Build and test (push) Successful in 8m36s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
CI / PostgreSQL 16 integration (push) Successful in 11m22s
CI / PostgreSQL 17 integration (push) Successful in 11m38s
CI / Docker image (push) Successful in 54s
The read-ahead starts on the thread pool, so the demand loads could run before it developed a frame and the test failed at random on the shared runner (rc.8's release build and main's CI). The test now waits, within a scaled budget, until the read-ahead has developed a frame of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #15.
This commit is contained in:
1 parent
9b24cf74fc
commit
30a5b03f37
1 file changed
+11
-1
@@ -118,7 +118,17 @@ public sealed class DecodeParallelismTests
|
||||
await using (var source = new SequenceFrameSource(frames, frames.LightFrames(), new ImageDecoder([decoder]), window))
|
||||
{
|
||||
Assert.Equal(1, source.DevelopingLimit(1920, DecodePurpose.Render));
|
||||
foreach (var index in new[] { 0, 2, 4, 6 })
|
||||
using (await source.GetFrameAsync(0, 1920, DecodePurpose.Render, CancellationToken.None)) { }
|
||||
// The read-ahead starts on the thread pool; on a busy runner it may not have begun before the next frames are
|
||||
// asked for, and then nothing would race. Wait until it develops a frame of its own, so the demand loads below
|
||||
// always meet a developing read-ahead.
|
||||
var started = DateTime.UtcNow;
|
||||
while (decoder.Decodes < 2)
|
||||
{
|
||||
Assert.True(DateTime.UtcNow - started < TimeSpan.FromSeconds(TestTiming.Budget(10)), "the read-ahead never started");
|
||||
await Task.Delay(5);
|
||||
}
|
||||
foreach (var index in new[] { 2, 4, 6 })
|
||||
using (await source.GetFrameAsync(index, 1920, DecodePurpose.Render, CancellationToken.None)) { }
|
||||
}
|
||||
Assert.Equal(1, decoder.Peak);
|
||||
|
||||
Reference in new issue
Block a user