Skip to content

Commit

Permalink
Use object form of Long for zrank() return type
Browse files Browse the repository at this point in the history
The Jedis docs for each command are just a copy paste of Redis docs
which doesn't translate well to Java.
redis/jedis#978

From some stack overflow googling, we see the right way to use
zrank(), and this patch changes the code to comply with that.
  • Loading branch information
smukil committed Oct 2, 2019
1 parent c3fc231 commit d9cfc62
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,9 @@ public Message popWithMsgIdHelper(String messageId, String targetShard) {

ZAddParams zParams = ZAddParams.zAddParams().nx();

try {
long exists = nonQuorumConn.zrank(queueShardName, messageId);
// If an exception wasn't thrown, the element has to exist.
assert(exists >= 0);
} catch (NullPointerException e) {
// If we get a NPE, that means "messageId" does not exist in the sorted set.
Long exists = nonQuorumConn.zrank(queueShardName, messageId);
// If we get back a null type, then the element doesn't exist.
if (exists == null) {
if (logger.isDebugEnabled()) {
logger.debug("Cannot find the message with ID {}", messageId);
}
Expand Down

0 comments on commit d9cfc62

Please sign in to comment.