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

Redis client xrevrange command has an issue with reading n elements from given stream #59

Open
dhruvkakadiya opened this issue Feb 21, 2020 · 0 comments

Comments

@dhruvkakadiya
Copy link

dhruvkakadiya commented Feb 21, 2020

As per xrevrange documentation, to get number of elements from given stream "COUNT" word needs to be there before actual value which is missing in current code.

Current code:

	client &
	client::xrevrange(const std::string &key, const range_options_t &range_args, const reply_callback_t &reply_callback) {
		std::vector<std::string> cmd = {"XREVRANGE", key, range_args.Start, range_args.Stop};
		if (range_args.Count > 0) {
			cmd.emplace_back(std::to_string(range_args.Count));
		}
		send(cmd, reply_callback);
		return *this;
	}

Fixed code:

	client &
	client::xrevrange(const std::string &key, const range_options_t &range_args, const reply_callback_t &reply_callback) {
		std::vector<std::string> cmd = {"XREVRANGE", key, range_args.Start, range_args.Stop};
		if (range_args.Count > 0) {
			cmd.emplace_back("COUNT");
			cmd.push_back(std::to_string(range_args.Count));
		}
		send(cmd, reply_callback);
		return *this;
	}
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

1 participant