Added worker app.
All checks were successful
ci / build-test (push) Successful in 2m16s
ci / publish-image (push) Has been skipped

This commit is contained in:
2026-02-01 21:41:23 -05:00
parent c51775592e
commit 340c62d18b
12 changed files with 309 additions and 25 deletions

View File

@@ -0,0 +1,28 @@
namespace JSMR.Worker.Services;
public sealed class FileCheckpointStore : ICheckpointStore
{
private readonly string _root = Path.Combine(AppContext.BaseDirectory, "State");
public FileCheckpointStore() => Directory.CreateDirectory(_root);
public Task<int?> GetLastPageAsync(string locale, CancellationToken ct)
{
string path = Path.Combine(_root, $"scan.{locale}.page");
if (!File.Exists(path))
return Task.FromResult<int?>(null);
if (int.TryParse(File.ReadAllText(path).Trim(), out var n))
return Task.FromResult<int?>(n);
return Task.FromResult<int?>(null);
}
public Task SaveLastPageAsync(string locale, int page, CancellationToken ct)
{
string path = Path.Combine(_root, $"scan.{locale}.page");
File.WriteAllText(path, page.ToString());
return Task.CompletedTask;
}
}