fix: address the owner review 5 review
Setup: a kept 1.0 Uploader no longer fixes the scope and folder, the Remove tooltip promises kept files only with a hashed log, and a single-program setup preselects it. The Uploader always downloads the setup. Sync links move to the server id at every sign-in while folders wait for jobs and open editors; jobs of a pending homes sort still find their projects. A shared library exposes only the shared archive's client-visible jobs and events, render nodes take only client renders, and the share counts as its own while starting. Progress: a new step waits a quarter interval and a trailing timer publishes the last state; the job bar tooltip carries the whole line; Recent maintenance and the Server jobs list pick up jobs that start while they are shown. Refs #64 #65 #66 #67 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
817956e719
commit
f30eb2904a
51 files changed
+895
-122
No files matched your search
@@ -5,16 +5,71 @@ using Chronos.Testing;
|
||||
|
||||
namespace Chronos.Data.Tests.Jobs;
|
||||
|
||||
/// <summary>A clock the test moves by hand (BCL <see cref="TimeProvider"/>, no package).</summary>
|
||||
/// <summary>
|
||||
/// A clock the test moves by hand (BCL <see cref="TimeProvider"/>, no package), whose timers fire only when
|
||||
/// <see cref="Advance"/> reaches them, on the test's thread.
|
||||
/// </summary>
|
||||
internal sealed class ManualTime : TimeProvider
|
||||
{
|
||||
private readonly Lock _gate = new();
|
||||
private readonly List<Timer> _timers = [];
|
||||
private long _ticks;
|
||||
|
||||
public override long TimestampFrequency => TimeSpan.TicksPerSecond;
|
||||
|
||||
public override long GetTimestamp() => Interlocked.Read(ref _ticks);
|
||||
|
||||
public void Advance(TimeSpan by) => Interlocked.Add(ref _ticks, by.Ticks);
|
||||
public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
|
||||
{
|
||||
var timer = new Timer(this, callback, state);
|
||||
timer.Change(dueTime, period);
|
||||
return timer;
|
||||
}
|
||||
|
||||
/// <summary>Moves the clock on, then fires each one-shot timer due by then.</summary>
|
||||
public void Advance(TimeSpan by)
|
||||
{
|
||||
List<Timer> due;
|
||||
lock (_gate)
|
||||
{
|
||||
var now = Interlocked.Add(ref _ticks, by.Ticks);
|
||||
due = [.. _timers.Where(t => t.Due <= now)];
|
||||
foreach (var timer in due) _timers.Remove(timer);
|
||||
}
|
||||
foreach (var timer in due) timer.Fire();
|
||||
}
|
||||
|
||||
private void Schedule(Timer timer, TimeSpan dueTime)
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
_timers.Remove(timer);
|
||||
if (dueTime == Timeout.InfiniteTimeSpan) return;
|
||||
timer.Due = Interlocked.Read(ref _ticks) + dueTime.Ticks;
|
||||
_timers.Add(timer);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class Timer(ManualTime clock, TimerCallback callback, object? state) : ITimer
|
||||
{
|
||||
public long Due { get; set; }
|
||||
|
||||
public bool Change(TimeSpan dueTime, TimeSpan period)
|
||||
{
|
||||
clock.Schedule(this, dueTime);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Fire() => callback(state);
|
||||
|
||||
public void Dispose() => clock.Schedule(this, Timeout.InfiniteTimeSpan);
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
Dispose();
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("jobs")]
|
||||
|
||||
Reference in new issue
Block a user