mirror of
https://github.com/rmcrackan/Libation.git
synced 2026-09-12 21:57:19 -04:00
Stop the dispatch tests measuring the CI runner instead of the loop
EffectiveConcurrentDownloads clamps the setting by Environment.ProcessorCount, so a test asking for three books at once starts only two on a small machine, waits out its ten second patience and fails. Reproduced with DOTNET_PROCESSOR_COUNT=2: three failures and a thirty-four second run, against five seconds and none on a sixteen core box. The CI matrix includes runners small enough to hit it. Machine capability is now overridable, and the dispatch tests pin it to the concurrency they are asking about. The clamp itself is unchanged in the app. Two tests for the seam while it is there, since neither the point-of-use clamp nor the hint had any coverage: that a machine smaller than the setting holds the loop down without rewriting what the user asked for, and that ConcurrencyHint says so and falls silent when the machine can keep up.
This commit is contained in:
1 parent
29a9cb3873
commit
b6875591f0
2 files changed
+54
-2
No files matched your search
@@ -88,12 +88,22 @@ public class ProcessQueueViewModel : ReactiveObject
|
||||
}
|
||||
private int _maxConcurrentDownloads;
|
||||
|
||||
/// <summary>
|
||||
/// What this machine can usefully manage. Overridable so that tests of the dispatch loop pin it
|
||||
/// instead of inheriting the host's core count - otherwise a test asking for three books at once
|
||||
/// passes on a developer's machine and fails on a two-core CI runner, having tested the runner
|
||||
/// rather than the loop.
|
||||
/// </summary>
|
||||
internal int? MachineCeilingOverride { get; set; }
|
||||
|
||||
private int MachineCeiling => MachineCeilingOverride ?? Configuration.MaxAllowedConcurrentDownloads;
|
||||
|
||||
/// <summary>
|
||||
/// How many books actually run at once: what the user asked for, held down to what this machine
|
||||
/// can usefully manage. Applied here, at the point of use, so the stored setting is left alone.
|
||||
/// </summary>
|
||||
private int EffectiveConcurrentDownloads
|
||||
=> Math.Clamp(MaxConcurrentDownloads, Configuration.MinConcurrentDownloads, Configuration.MaxAllowedConcurrentDownloads);
|
||||
=> Math.Clamp(MaxConcurrentDownloads, Configuration.MinConcurrentDownloads, MachineCeiling);
|
||||
public bool AutoScrollQueue { get => field; set { RaiseAndSetIfChanged(ref field, value); Configuration.Instance.AutoScrollQueue = value; } }
|
||||
|
||||
/// <summary>Exposed so UI controls can bind their spinner bounds rather than hardcoding them.</summary>
|
||||
|
||||
Reference in new issue
Block a user