From f9b490c24fd091eeeb3f11552206ab273fc72387 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Mon, 19 Oct 2026 12:19:01 -0400 Subject: [PATCH] Log cases where a watch is set before the previous one is resolved --- .../storage/foundationdb/FoundationDbMessagePublisher.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/foundationdb/FoundationDbMessagePublisher.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/foundationdb/FoundationDbMessagePublisher.java index 16d420385..ad8f4edee 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/foundationdb/FoundationDbMessagePublisher.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/foundationdb/FoundationDbMessagePublisher.java @@ -417,6 +417,13 @@ class FoundationDbMessagePublisher { // If we're already in a terminal state, we don't want to set a watch that would leak return; } + + if (watchFuture != null && !watchFuture.isDone()) { + LOGGER.warn("Setting a watch before previous watch future is done"); + } + + cancelWatch(); + // Set a watch that will be triggered when new messages arrive. When it is triggered, we attempt to fetch messages // again (if there is demand). When we run out of messages, this method will be called again, setting another watch, // and so on, thus achieving a "watch for new messages -> read -> publish" loop.