Log cases where a watch is set before the previous one is resolved

This commit is contained in:
Jon Chambers authored and ravi-signal committed 2026-10-19 15:04:31 -05:00
1 parent faff0e1751
commit f9b490c24f
1 file changed
+7
@@ -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.