jdeppe-pivotal commented on a change in pull request #7408:
URL: https://github.com/apache/geode/pull/7408#discussion_r825629391



##########
File path: 
geode-for-redis/src/main/java/org/apache/geode/redis/internal/data/RedisList.java
##########
@@ -154,6 +160,35 @@ public long lpush(List<byte[]> elementsToAdd, 
Region<RedisKey, RedisData> region
     return popped;
   }
 
+  public static List<byte[]> blpop(ExecutionHandlerContext context, 
List<RedisKey> keys,
+      double timeoutSeconds) {
+    RegionProvider regionProvider = context.getRegionProvider();
+    for (RedisKey key : keys) {
+      RedisList list = regionProvider.getTypedRedisData(REDIS_LIST, key, 
false);
+      if (!list.isNull()) {
+        byte[] poppedValue = list.lpop(context.getRegion(), key);
+
+        // return the key and value
+        List<byte[]> result = new ArrayList<>(2);
+        result.add(key.toBytes());
+        result.add(poppedValue);
+        return result;
+      }
+    }
+
+    List<byte[]> commandArgs = new ArrayList<>(keys.size() + 1);
+    commandArgs.add(RedisCommandType.BLPOP.name().getBytes());
+    keys.forEach(x -> commandArgs.add(x.toBytes()));
+    // This is a placeholder for the timeout. If the command is resubmitted it 
will be updated with
+    // an adjusted timeout value.
+    commandArgs.add("0".getBytes());

Review comment:
       `'0'` is a `char` and not a `byte[]`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to