Skip to content

Commit f099711

Browse files
committed
fix
1 parent 74a7583 commit f099711

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

driver-core/src/main/com/mongodb/internal/connection/DefaultServerMonitor.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,18 @@ public void run() {
216216
continue;
217217
}
218218

219+
// For POLL mode, if we just established initial connection, do an immediate heartbeat
220+
boolean justConnected = previousServerDescription.getType() == UNKNOWN
221+
&& currentServerDescription.getType() != UNKNOWN
222+
&& !shouldStreamResponses
223+
&& connection != null && !connection.isClosed();
224+
225+
if (justConnected) {
226+
// Do immediate heartbeat for newly connected server in POLL mode
227+
// to fire the ServerHeartbeatSucceededEvent
228+
continue;
229+
}
230+
219231
logStateChange(previousServerDescription, currentServerDescription);
220232
sdamProvider.get().monitorUpdate(currentServerDescription);
221233

0 commit comments

Comments
 (0)