XREADGROUP/XREAD should be blocked when block is 0

This commit is contained in:
zhengshuxin 2019-05-14 11:13:49 +08:00
parent 9b4d238793
commit 70d46d567b
2 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,9 @@
修改历史列表: 修改历史列表:
568) 2019.5.14
568.1) bugfix: redis_stream.cpp 中针对 XREADGROUP/XREAD 命令,当 block 为 0 时,
应该采用阻塞模式等待消息到达
567) 2019.5.9 567) 2019.5.9
567.1) safety & feature: 针对所有不允许拷贝复制的对象,增加了 noncopyable 限制, 567.1) safety & feature: 针对所有不允许拷贝复制的对象,增加了 noncopyable 限制,
以防止使用者因用错而造成的潜在问题 以防止使用者因用错而造成的潜在问题

View File

@ -199,17 +199,14 @@ void redis_stream::build(const std::map<string, string>& streams, size_t i,
} }
char block_s[LONG_LEN]; char block_s[LONG_LEN];
if (block > 0) { argv_[i] = "BLOCK";
argv_[i] = "BLOCK"; argv_lens_[i] = sizeof("BLOCK") - 1;
argv_lens_[i] = sizeof("BLOCK") - 1; i++;
i++;
safe_snprintf(block_s, sizeof(block_s), "%lu", safe_snprintf(block_s, sizeof(block_s), "%lu", (unsigned long) block);
(unsigned long) block); argv_[i] = block_s;
argv_[i] = block_s; argv_lens_[i] = strlen(block_s);
argv_lens_[i] = strlen(block_s); i++;
i++;
}
if (noack) { if (noack) {
argv_[i] = "NOACK"; argv_[i] = "NOACK";