NewLifeX / NewLife.Redis

High performance redis client, support NETCore/. NET4. 0/. NET4. 5. It is specially optimized for big data and message queue. The average daily consumption of online single application is 10 billion. 高性能Redis客户端,支持.NETCore/.NET4.0/.NET4.5,为大数据与消息队列而特别优化,线上单应用日均100亿调用量
MIT License
845 stars 180 forks source link

DelayQueue 列队问题 #133

Closed xin12023 closed 4 months ago

xin12023 commented 4 months ago

创建了一个 DelayQueue 列队 value:{"Id":17741492324117,"OrderNo":"superadmin","Type":"Orders","Addition":null,"CreateTime":"2024-07-12T13:20:10.0000000"} score: 1720874520 确认时间已到达 读取时使用 _cacheQueue.Take(count) count > 0 读取到的数量为0

如果 value:{"Id":17741492324117,"OrderNo":"superadmin","Type":"Orders","Addition":null,"CreateTime":null} score: 1720874520

读取使用 读取时使用 _cacheQueue.Take(count) count > 0 可以正常被读取到

microsofter commented 4 months ago

已经收到您的来信,我会尽快回复。

xin12023 commented 4 months ago

再次测试写入值 {"Id":17741492324117,"OrderNo":"superadmin","Type":"Orders","Addition":null,"CreateTime":"2024-07-12T18:50:10.0000000\u002B05:30"} 可以被弹出列队

nnhy commented 4 months ago

延迟队列,本质上使用了Redis的排序集合 ZSET,那个分数,就是消息到期时间的UTC毫秒值。 延迟队列DelayQueue内部会定期(很短)轮询该队列,查找分数达标的数据。