-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
In the special case where consumer group lag is unavailable XINFO GROUPS lag is reported as null.
The Lag property on StreamGroupInfo is long?, so the type is correct.
But when this happens, the value is set to 0 and not null.
Test using Xunit.
public class LagTest
{
[Theory]
[InlineData(false)]
[InlineData(true)]
public void GroupLagTest(bool deleteLastEntry)
{
// Arrange
const string stream = "stream";
const string group = "group";
NameValueEntry entry = new NameValueEntry("name", "value");
var db = ConnectionMultiplexer.Connect("localhost").GetDatabase();
db.Execute("FLUSHDB");
db.StreamCreateConsumerGroup("stream", "group");
db.StreamAdd("stream", [entry]);
db.StreamReadGroup(stream, group, "consumer", "0-0", 1);
db.StreamAdd("stream", [entry]);
// Act
var streamInfo = db.StreamInfo("stream");
if (deleteLastEntry)
{
db.StreamDelete(stream, [streamInfo.LastEntry.Id]);
}
// Assert
var groupInfo = db.StreamGroupInfo("stream").Single(g => g.Name == "group");
var redisResult = db.Execute("XINFO", "GROUPS", stream);
long? lag = (long?)redisResult[0][11];
Assert.Equal(lag, groupInfo.Lag);
}
}
Metadata
Metadata
Assignees
Labels
No labels