|
34 | 34 | import org.springframework.data.redis.core.KeyBoundCursor;
|
35 | 35 | import org.springframework.data.redis.core.ScanIteration;
|
36 | 36 | import org.springframework.data.redis.core.ScanOptions;
|
| 37 | +import org.springframework.data.redis.core.TimeoutUtils; |
37 | 38 | import org.springframework.lang.Nullable;
|
38 | 39 | import org.springframework.util.Assert;
|
39 | 40 |
|
@@ -370,7 +371,7 @@ public Tuple bZPopMin(byte[] key, long timeout, TimeUnit unit) {
|
370 | 371 | if(TimeUnit.MILLISECONDS == unit) {
|
371 | 372 |
|
372 | 373 | return connection.invoke(connection.getAsyncDedicatedConnection())
|
373 |
| - .from(RedisSortedSetAsyncCommands::bzpopmin, preciseTimeout(timeout, unit), key) |
| 374 | + .from(RedisSortedSetAsyncCommands::bzpopmin, TimeoutUtils.toDoubleSeconds(timeout, unit), key) |
374 | 375 | .get(it -> it.map(LettuceConverters::toTuple).getValueOrElse(null));
|
375 | 376 | }
|
376 | 377 |
|
@@ -420,7 +421,7 @@ public Tuple bZPopMax(byte[] key, long timeout, TimeUnit unit) {
|
420 | 421 | if(TimeUnit.MILLISECONDS == unit) {
|
421 | 422 |
|
422 | 423 | return connection.invoke(connection.getAsyncDedicatedConnection())
|
423 |
| - .from(RedisSortedSetAsyncCommands::bzpopmax, preciseTimeout(timeout, unit), key) |
| 424 | + .from(RedisSortedSetAsyncCommands::bzpopmax, TimeoutUtils.toDoubleSeconds(timeout, unit), key) |
424 | 425 | .get(it -> it.map(LettuceConverters::toTuple).getValueOrElse(null));
|
425 | 426 | }
|
426 | 427 |
|
@@ -914,8 +915,4 @@ private static io.lettuce.core.ZAddArgs toZAddArgs(ZAddArgs source) {
|
914 | 915 | }
|
915 | 916 | return target;
|
916 | 917 | }
|
917 |
| - |
918 |
| - static double preciseTimeout(long val, TimeUnit unit) { |
919 |
| - return (double) unit.toMillis(val) / 1000.0D; |
920 |
| - } |
921 | 918 | }
|
0 commit comments