feat: harden jetstream consumer state machine parity
This commit is contained in:
@@ -3,9 +3,13 @@ namespace NATS.Server.JetStream.Consumers;
|
||||
public sealed class AckProcessor
|
||||
{
|
||||
private readonly Dictionary<ulong, PendingState> _pending = new();
|
||||
public ulong AckFloor { get; private set; }
|
||||
|
||||
public void Register(ulong sequence, int ackWaitMs)
|
||||
{
|
||||
if (sequence <= AckFloor)
|
||||
return;
|
||||
|
||||
if (_pending.ContainsKey(sequence))
|
||||
return;
|
||||
|
||||
@@ -55,6 +59,9 @@ public sealed class AckProcessor
|
||||
{
|
||||
foreach (var key in _pending.Keys.Where(k => k <= sequence).ToArray())
|
||||
_pending.Remove(key);
|
||||
|
||||
if (sequence > AckFloor)
|
||||
AckFloor = sequence;
|
||||
}
|
||||
|
||||
private sealed class PendingState
|
||||
|
||||
Reference in New Issue
Block a user