mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 12:36:53 +00:00
Resolve minor warnings/suggestions throughout MessagePersister and MessagePersisterTest
This commit is contained in:
1 parent
9ff1431488
commit
a142916fef
2 files changed
+14
-8
No files matched your search
+4
-2
@@ -290,7 +290,8 @@ public class MessagePersister implements Managed {
|
||||
})
|
||||
.takeWhile(Optional::isPresent)
|
||||
.flatMap(maybeEnvelope -> {
|
||||
final MessageProtos.Envelope envelope = maybeEnvelope.get();
|
||||
// We know this must be present because we `takeWhile` values are present
|
||||
final MessageProtos.Envelope envelope = maybeEnvelope.orElseThrow(AssertionError::new);
|
||||
TRIMMED_MESSAGE_COUNTER.increment();
|
||||
TRIMMED_MESSAGE_BYTES_COUNTER.increment(envelope.getSerializedSize());
|
||||
return Mono
|
||||
@@ -302,7 +303,8 @@ public class MessagePersister implements Managed {
|
||||
.reduce(Pair.of(0L, 0L), (acc, deleted) -> deleted
|
||||
? Pair.of(acc.getLeft() + 1, acc.getRight())
|
||||
: Pair.of(acc.getLeft(), acc.getRight() + 1))
|
||||
.block();
|
||||
.blockOptional()
|
||||
.orElseGet(() -> Pair.of(0L, 0L));
|
||||
|
||||
logger.warn(
|
||||
"Finished trimming {}:{}. Oldest message = {}, newest message = {}. Attempted to delete {} persisted bytes to make room for {} cached message bytes. Delete outcomes: {} present, {} missing.",
|
||||
|
||||
Reference in new issue
Block a user