-
Notifications
You must be signed in to change notification settings - Fork 53
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
Python: add BZPOPMIN and BZPOPMAX commands #1399
Python: add BZPOPMIN and BZPOPMAX commands #1399
Conversation
@@ -21,6 +21,7 @@ pub(crate) enum ExpectedReturnType { | |||
Lolwut, | |||
ArrayOfArraysOfDoubleOrNull, | |||
ArrayOfKeyValuePairs, | |||
KeyWithMemberAndScore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this wasn't included in the Java implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ig it was forgotten, good catch:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah its because the conversion is needed for RESP2 responses. The Java wrapper doesn't support RESP2 yet but Python does
if array.len() == 3 | ||
&& matches!(array[2], Value::BulkString(_) | Value::SimpleString(_)) => | ||
{ | ||
array[2] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this only convert the third argument to double? Can there be more arguments with more keys where the timeout is greater than the third argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis> ZADD zset1 0 a 1 b 2 c
(integer) 3
redis> BZPOPMIN zset1 zset2 0
1) "zset1"
2) "a"
3) "0"
replay can be one of the following:
Nil reply: when no element could be popped and the timeout expired.
Array reply: the keyname, popped member, and its score.
so when its an array replay, which means we popped an element, we want to convert just the score from string to double
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np
@@ -21,6 +21,7 @@ pub(crate) enum ExpectedReturnType { | |||
Lolwut, | |||
ArrayOfArraysOfDoubleOrNull, | |||
ArrayOfKeyValuePairs, | |||
KeyWithMemberAndScore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ig it was forgotten, good catch:)
if array.len() == 3 | ||
&& matches!(array[2], Value::BulkString(_) | Value::SimpleString(_)) => | ||
{ | ||
array[2] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis> ZADD zset1 0 a 1 b 2 c
(integer) 3
redis> BZPOPMIN zset1 zset2 0
1) "zset1"
2) "a"
3) "0"
replay can be one of the following:
Nil reply: when no element could be popped and the timeout expired.
Array reply: the keyname, popped member, and its score.
so when its an array replay, which means we popped an element, we want to convert just the score from string to double
BZPOPMAX is the blocking variant of ZPOPMAX. | ||
|
||
BZPOPMAX is a client blocking command, see https://github.com/aws/glide-for-redis/wiki/General-Concepts#blocking-commands for more details and best practices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BZPOPMAX is the blocking variant of ZPOPMAX. | |
BZPOPMAX is a client blocking command, see https://github.com/aws/glide-for-redis/wiki/General-Concepts#blocking-commands for more details and best practices. | |
`BZPOPMAX` is the blocking variant of `ZPOPMAX`. | |
`BZPOPMAX` is a client blocking command, see https://github.com/aws/glide-for-redis/wiki/General-Concepts#blocking-commands for more details and best practices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think hyperlinks like these are supported by default, according to this stack overflow post they aren't, but some tools and/or documentation generators may support them. Looks like VScode does, but I'm using pycharm and it doesn't. Let me know if you still want me to change this to a hyperlink though
a67c7ba
to
3f1e3c4
Compare
@shohamazon Thanks for the review, all comments are addressed now |
@aaron-congo please, resolve conflicts and merge |
9c3e15f
to
6a23610
Compare
* Python: add BZPOPMIN and BZPOPMAX commands (#266) * Update PR link * PR suggestions * Fix rust
* Python: add BZPOPMIN and BZPOPMAX commands (#266) * Update PR link * PR suggestions * Fix rust
Issue #, if available:
N/A
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.