test(sync): upload, download, resume, proxies and live events against the real server
The first original of an upload now creates the server sequence through its session key (the archive ingest files API-created empty sequences nowhere), and settings sent after an upload are retried when the server's own analysis edits the new sequence meanwhile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
9 files changed
+420
-49
No files matched your search
@@ -260,17 +260,32 @@ public sealed class SyncService
|
||||
return link;
|
||||
}
|
||||
|
||||
/// <summary>Makes the server's copy equal to this PC's (an upload sends the settings with the originals).</summary>
|
||||
/// <summary>
|
||||
/// Makes the server's copy equal to this PC's (an upload sends the settings with the originals of the sequence it
|
||||
/// created); the server's own processing may edit the new sequence meanwhile, so a refused edit is sent again.
|
||||
/// </summary>
|
||||
internal async Task PushAllAsync(ISyncRemote remote, Guid remoteId, CancellationToken cancellationToken)
|
||||
{
|
||||
await _gate.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
var (link, local) = await LinkedAsync(remote.Server, remoteId, cancellationToken).ConfigureAwait(false);
|
||||
var dto = await remote.GetSequenceAsync(remoteId, cancellationToken).ConfigureAwait(false);
|
||||
var updated = await remote.UpdateSequenceAsync(remoteId, SyncPayload.Of(local).ToRequest(dto.SettingsVersion), cancellationToken).ConfigureAwait(false);
|
||||
await _links.UpsertAsync(Agreed(Observe(link, remote.Server, updated), local.SettingsVersion, updated.SettingsVersion), cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
for (var attempt = 1; ; attempt++)
|
||||
{
|
||||
var dto = await remote.GetSequenceAsync(remoteId, cancellationToken).ConfigureAwait(false);
|
||||
try
|
||||
{
|
||||
var updated = await remote.UpdateSequenceAsync(remoteId, SyncPayload.Of(local).ToRequest(dto.SettingsVersion), cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
await _links.UpsertAsync(Agreed(Observe(link, remote.Server, updated), local.SettingsVersion, updated.SettingsVersion), cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
catch (TitanoApiException ex) when (ex.Status == HttpStatusCode.Conflict && attempt < 3)
|
||||
{
|
||||
Log.Info(LogCategory, $"{local.DisplayTitle} changed on the server while its settings were sent; sending again");
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user