0
如果在redis服务器执行命令时客户端断开连接,则使用LPOP时,弹出的项目会发生什么?客户端断开连接时的redis lpop行为
更具体地说,即使它没有交付或者它保存在内存中,该项目是否被删除,因为命令没有成功?
感谢您的任何帮助/指针。
如果在redis服务器执行命令时客户端断开连接,则使用LPOP时,弹出的项目会发生什么?客户端断开连接时的redis lpop行为
更具体地说,即使它没有交付或者它保存在内存中,该项目是否被删除,因为命令没有成功?
感谢您的任何帮助/指针。
处理实际弹出逻辑的代码部分忽略了客户端状态。 Redis不会等待响应发送完成以完成处理命令。如果像这样等待,它会很慢,特别是单线程。
你可以看看,处理BLPOP怎么看这种情况的部分代码:
// here is where redis actually pops from the list
robj *value = listTypePop(o,where);
serverAssert(value != NULL);
// now it ads the reply to the client's queue (c is the client)
// but as you can see there is no return code from these methods
// and redis doesn't actually send anything when addReply is called
addReplyMultiBulkLen(c,2);
addReplyBulk(c,c->argv[j]);
addReplyBulk(c,value);