Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行XPending时,如果Stream的pending数据为空时,会报错 #457

Open
yus1977 opened this issue Sep 6, 2022 · 3 comments
Open

Comments

@yus1977
Copy link

yus1977 commented Sep 6, 2022

错误为:
System.OverflowException:“Arithmetic operation resulted in an overflow.”

代码示例:

            //删除,重新创建,并加入数据,进行测试
            redis.Del(key);
            redis.XGroupCreate(key, group, "0", true);
            redis.XAdd(key, maxLen, "*", ("__data", "my data1"));
            redis.XAdd(key, maxLen, "*", ("__data", "my data2"));

            //检查pending表的长度
            //!!!!!!pending表不存在时,读取会报错!!!!!!!!!
            var pending0 = redis.XPending(key, group);
            //消费确认前,pending 应该等于0
            Assert.True(pending0.count == 0);

            //读取未阅读的消息1,读取2次
            var new1 = redis.XReadGroup(group, consumer, 1, 1,(key, ">"));
            var new2 = redis.XReadGroup(group, consumer, 1, 1,(key, ">"));
            new1[0].data.Should().NotBeNullOrEmpty();
            new2[0].data.Should().NotBeNullOrEmpty();

            //检查pending表的长度
            var pending = redis.XPending(key, group);
            //消费确认前,pending 应该等于2
            Assert.True(pending.count == 2);

            //消费确认
            var id1 = new1[0].data[0].id;
            var id2 = new2[0].data[0].id;
            redis.XAck(key, group, id1);
            redis.XAck(key, group, id2);

            //检查pending表的长度
            //!!!!!!pending表不存在时,读取会报错!!!!!!!!!
            var pending2 = redis.XPending(key, group);
            //消费确认后,pending 应该等于0
            //Assert.True(pending2.count == 0);
@2881099
Copy link
Owner

2881099 commented Sep 6, 2022

在 FreeRedis 上测试没问题,FreeRedis 对 redis-server5.0+ 支持得更好一些

2881099 added a commit that referenced this issue Sep 6, 2022
@2881099
Copy link
Owner

2881099 commented Sep 6, 2022

v3.8.666 已修复

@yus1977
Copy link
Author

yus1977 commented Sep 6, 2022

多谢!!
FreeRedis 上是没有问题的
只是一些老项目用了CSRedis,还没有完全迁移过来

2881099 added a commit that referenced this issue Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants