feat: owner review 2 phase 5b: the server as a project home (#17)
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s
A Chronos Server keeps its sequences' projects, as a PC's archive does: Main and named projects with versions under /api/v1/sequences/{id}/projects, the projects capability and the projectChanged event. The desktop opens a server's sequences in the workspace (proxies downloaded, hash-checked, resumable) with Save version, Sync, conflicts, History, Restore and the project actions against the server. Renders can be of a project version. The admin panel lists a sequence's projects and versions. Strings in all 38 languages.
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 #17.
This commit is contained in:
1 parent
255e149087
commit
81c303f484
325 files changed
+11477
-516
No files matched your search
@@ -27,6 +27,9 @@ internal sealed class FakeSyncRemote : ISyncRemote
|
||||
/// <summary>Listings still to fail with a network error.</summary>
|
||||
public int FailingListings { get; set; }
|
||||
|
||||
/// <summary>Event streams still to be lost right after they opened.</summary>
|
||||
public int FailingEvents { get; set; }
|
||||
|
||||
/// <summary>The next original download of this frame returns damaged bytes.</summary>
|
||||
public Guid? CorruptOnce { get; set; }
|
||||
|
||||
@@ -72,7 +75,27 @@ internal sealed class FakeSyncRemote : ISyncRemote
|
||||
}
|
||||
}
|
||||
|
||||
public void Publish(ServerEvent e) => _events.Writer.TryWrite(e);
|
||||
/// <summary>
|
||||
/// Sends an event to the stream open now. With <see cref="DropWhileClosed"/>, one sent while no stream is open is lost,
|
||||
/// as a real server's is.
|
||||
/// </summary>
|
||||
public void Publish(ServerEvent e)
|
||||
{
|
||||
if (DropWhileClosed && !Subscribed) return;
|
||||
_events.Writer.TryWrite(e);
|
||||
}
|
||||
|
||||
/// <summary>Events sent while no stream is open are lost (<see cref="Publish"/>).</summary>
|
||||
public bool DropWhileClosed { get; set; }
|
||||
|
||||
/// <summary>How long a stream takes to open after a lost one (a reconnection).</summary>
|
||||
public TimeSpan ReconnectDelay { get; set; }
|
||||
|
||||
/// <summary>Whether an event stream is open now.</summary>
|
||||
public bool Subscribed => Volatile.Read(ref _subscribed) > 0;
|
||||
|
||||
private int _subscribed;
|
||||
private int _opened;
|
||||
|
||||
public Task<IReadOnlyList<SequenceDto>> ListSequencesAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -249,11 +272,31 @@ internal sealed class FakeSyncRemote : ISyncRemote
|
||||
}
|
||||
}
|
||||
|
||||
public async IAsyncEnumerable<ServerEvent> EventsAsync([EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
public IAsyncEnumerable<ServerEvent> EventsAsync(CancellationToken cancellationToken) => EventsAsync(() => { }, cancellationToken);
|
||||
|
||||
public async IAsyncEnumerable<ServerEvent> EventsAsync(Action connected, [EnumeratorCancellation] CancellationToken cancellationToken)
|
||||
{
|
||||
while (await _events.Reader.WaitToReadAsync(cancellationToken))
|
||||
if (Interlocked.Increment(ref _opened) > 1 && ReconnectDelay > TimeSpan.Zero) await Task.Delay(ReconnectDelay, cancellationToken);
|
||||
lock (_gate)
|
||||
{
|
||||
while (_events.Reader.TryRead(out var e)) yield return e;
|
||||
if (FailingEvents > 0)
|
||||
{
|
||||
FailingEvents--;
|
||||
throw new HttpRequestException("socket closed");
|
||||
}
|
||||
}
|
||||
Interlocked.Increment(ref _subscribed);
|
||||
try
|
||||
{
|
||||
connected();
|
||||
while (await _events.Reader.WaitToReadAsync(cancellationToken))
|
||||
{
|
||||
while (_events.Reader.TryRead(out var e)) yield return e;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Interlocked.Decrement(ref _subscribed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user