Update Sync

This commit is contained in:
2026-08-25 21:30:00 +02:00
parent 7245196689
commit 5e16ebf1bf
5 changed files with 154 additions and 17 deletions
+8 -2
View File
@@ -49,8 +49,14 @@ public class EventQueue : IDisposable
return evt;
}
public List<SyncEvent> GetPending(int max = 200) =>
_queue.Find(Query.All(nameof(SyncEvent.SequenceNr))).Take(max).ToList();
public List<SyncEvent> GetPending(int max = SyncProtocol.PushBatchSize,
IReadOnlySet<Guid>? excludedEventIds = null)
{
var pending = _queue.Find(Query.All(nameof(SyncEvent.SequenceNr))).AsEnumerable();
if (excludedEventIds is not null)
pending = pending.Where(e => !excludedEventIds.Contains(e.EventId));
return pending.Take(max).ToList();
}
public int PendingCount() => _queue.Count();
public void Acknowledge(IEnumerable<Guid> ids) { foreach (var id in ids) _queue.Delete(id); }
public long GetLastServerSeq() => _meta.FindById("serverSeq")?.Value ?? 0;