fix(archive): polling follows the archive folder; the index follows an archive.json changed elsewhere
- The desktop's rescans run for the whole session and each one targets the archive at Settings › Archive's folder (as the Import and Archive screens do), so an archive created on the first run, chosen in Settings, relinked or imported with settings is rescanned from the next tick on, and Rescan every always reaches a live timer. The folder of the start is reopened (relink, interrupted renames) as soon as its archive.json is there, so an unplugged drive or a folder without an archive no longer stops polling for the session. - ArchiveService.RefreshSettingsAsync reads archive.json and registers the archive again when its name, templates or proxy size changed elsewhere (a server's admin panel, another PC); null when the file cannot be read, is newer or belongs to another archive. Desktop rescans and the server's polling call it first, so imports, uploads and the admin panel follow the shared settings without a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
6 files changed
+224
-31
No files matched your search
@@ -102,6 +102,28 @@ public sealed class ArchiveModuleTests(TestContext context)
|
||||
await UntilIndexedAsync(server, archive.Id, "garden");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task SettingsADesktopChangedInArchiveJsonReachTheServerAtTheNextPoll()
|
||||
{
|
||||
await using var server = await TestServer.StartAsync(context, services: ArchiveModule.Register);
|
||||
var archive = server.Services.GetRequiredService<ServerArchive>();
|
||||
// A desktop sharing the archive changed its folder template and proxy size in archive.json.
|
||||
var path = new ArchivePaths(archive.Root).ManifestPath;
|
||||
var manifest = ManifestStore.ReadArchive(path);
|
||||
ManifestStore.WriteArchive(path, manifest with
|
||||
{
|
||||
LayoutTemplates = manifest.LayoutTemplates with { Folder = "{camera}/{date}" },
|
||||
ProxyPolicy = manifest.ProxyPolicy with { LongEdge = 2560 },
|
||||
});
|
||||
|
||||
await server.Services.GetRequiredService<ArchivePolling>().PollAsync(context.Cancellation);
|
||||
|
||||
// Uploads (the index row) and the admin panel (the served archive) follow it.
|
||||
Assert.Equal(("{camera}/{date}", 2560), (archive.Current.FolderTemplate, archive.Current.ProxyLongEdge));
|
||||
var row = Assert.NotNull(await server.Database.Archives.GetAsync(archive.Id, context.Cancellation));
|
||||
Assert.Equal(("{camera}/{date}", 2560), (row.FolderTemplate, row.ProxyLongEdge));
|
||||
}
|
||||
|
||||
private static async Task UntilIndexedAsync(TestServer server, Guid archiveId, string folder)
|
||||
{
|
||||
var until = DateTime.UtcNow + TimeSpan.FromSeconds(30);
|
||||
|
||||
Reference in new issue
Block a user