mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-01 16:06:47 +00:00
Perform end-of-queue-key processing outside of a transaction retry loop
This commit is contained in:
1 parent
253671c206
commit
450945a9cc
1 file changed
+9
-9
+9
-9
@@ -238,15 +238,15 @@ public class FoundationDbMessageStream implements MessageStream {
|
||||
///
|
||||
/// @return a [KeySelector] for the first key greater than the current greatest key in the device queue.
|
||||
private CompletableFuture<Optional<KeySelector>> getEndOfQueueKeyExclusive(final Database database) {
|
||||
return database.runAsync(
|
||||
transaction -> transaction.getRange(deviceQueueSubspace.range(), 1, true, StreamingMode.EXACT).asList()
|
||||
.thenApply(items -> {
|
||||
if (items.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
assert items.size() == 1;
|
||||
return Optional.of(KeySelector.firstGreaterThan(items.getFirst().getKey()));
|
||||
}));
|
||||
return database.runAsync(transaction ->
|
||||
transaction.getRange(deviceQueueSubspace.range(), 1, true, StreamingMode.EXACT).asList())
|
||||
.thenApply(items -> {
|
||||
if (items.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
assert items.size() == 1;
|
||||
return Optional.of(KeySelector.firstGreaterThan(items.getFirst().getKey()));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user