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

LPop返回超时 #45

Open
Lenkua opened this issue Aug 15, 2023 · 1 comment
Open

LPop返回超时 #45

Lenkua opened this issue Aug 15, 2023 · 1 comment

Comments

@Lenkua
Copy link

Lenkua commented Aug 15, 2023

bool CRedisClient::lpop(const std::string& key, std::string* value, Node* which, int num_retries)
{
    CommandArgs cmd_args;
    cmd_args.set_key(key);
    cmd_args.set_command("LPOP");
    cmd_args.add_arg(cmd_args.get_command());
    cmd_args.add_arg(key);
    cmd_args.final();

    // Bulk string reply: the value of the first element, or nil when key does not exist.
    const RedisReplyHelper redis_reply = redis_command(false, num_retries, key, cmd_args, which);
    if (REDIS_REPLY_NIL == redis_reply->type)
        return false;
    if (REDIS_REPLY_STRING == redis_reply->type)
        return get_value(redis_reply.get(), value);
    return true; // MULTI & EXEC the type always is REDIS_REPLY_STATUS
}

redis_command第一个参数is_read_command被设为false,导致异步模式下redisReply直接被丢弃

@eyjian
Copy link
Owner

eyjian commented Aug 28, 2023

谢谢3ef43bd4-86d3-4d23-abb3-bd686b944cce

@eyjian eyjian closed this as completed Aug 28, 2023
@eyjian eyjian reopened this Aug 28, 2023
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