-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Allow configuring the monitoring protocol to use; use the polling protocol in a FaaS environment by default #1313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
33631e1
d7aa01c
63562c6
1e74b01
640fd79
b7e461f
91a6ebb
2f3cdcb
bc589fb
315d66c
00c05ff
fa83aba
ac346ab
b372ca9
128741d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,8 +165,7 @@ public void run() { | |
logStateChange(previousServerDescription, currentServerDescription); | ||
sdamProvider.get().update(currentServerDescription); | ||
|
||
if (((connection == null || shouldStreamResponses(currentServerDescription)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this check "connection == null" not needed anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought I had proven to myself that the check was redundant by transforming to
and then allowing Intellij to simplify the expression, but when I tried it again IntelliJ didn't offer the simplification. This is a truly horrible conditional, and has been the source of at least one bug that I remember. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It had no effect, so I removed it. The following demonstrates why the Here is the original conditional, but reformatted to simplify perception: (
(connection == null || shouldStreamResponses(currentServerDescription))
&& currentServerDescription.getTopologyVersion() != null
&& currentServerDescription.getType() != UNKNOWN
)
||
(connection != null && connection.hasMoreToCome())
||
(
currentServerDescription.getException() instanceof MongoSocketException
&& previousServerDescription.getType() != UNKNOWN
) It consists of three Boolean expressions ORed (
Now the first ORed Boolean expression can be written as (
(x || s)
&& s
&& currentServerDescription.getType() != UNKNOWN
) If (
s
&& currentServerDescription.getType() != UNKNOWN
) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the clarification, @stIncMale. Now i see, It is indeed redundant check. i am curious about the original purpose of this check, given it wasn't functional. My assumption was that it might have aimed to bypass
Feel free to resolve the conversation if @jyemin has no further comments. |
||
&& currentServerDescription.getTopologyVersion() != null && currentServerDescription.getType() != UNKNOWN) | ||
if ((shouldStreamResponses(currentServerDescription) && currentServerDescription.getType() != UNKNOWN) | ||
|| (connection != null && connection.hasMoreToCome()) | ||
|| (currentServerDescription.getException() instanceof MongoSocketException | ||
&& previousServerDescription.getType() != UNKNOWN)) { | ||
|
@@ -199,7 +198,8 @@ private ServerDescription lookupServerDescription(final ServerDescription curren | |
if (LOGGER.isDebugEnabled()) { | ||
LOGGER.debug(format("Checking status of %s", serverId.getAddress())); | ||
} | ||
serverMonitorListener.serverHearbeatStarted(new ServerHeartbeatStartedEvent(connection.getDescription().getConnectionId())); | ||
serverMonitorListener.serverHearbeatStarted(new ServerHeartbeatStartedEvent( | ||
connection.getDescription().getConnectionId(), shouldStreamResponses(currentServerDescription))); | ||
|
||
long start = System.nanoTime(); | ||
try { | ||
|
@@ -227,13 +227,13 @@ private ServerDescription lookupServerDescription(final ServerDescription curren | |
long elapsedTimeNanos = System.nanoTime() - start; | ||
serverMonitorListener.serverHeartbeatSucceeded( | ||
new ServerHeartbeatSucceededEvent(connection.getDescription().getConnectionId(), helloResult, | ||
elapsedTimeNanos, currentServerDescription.getTopologyVersion() != null)); | ||
elapsedTimeNanos, shouldStreamResponses(currentServerDescription))); | ||
|
||
return createServerDescription(serverId.getAddress(), helloResult, averageRoundTripTime.getAverage()); | ||
} catch (Exception e) { | ||
serverMonitorListener.serverHeartbeatFailed( | ||
new ServerHeartbeatFailedEvent(connection.getDescription().getConnectionId(), System.nanoTime() - start, | ||
currentServerDescription.getTopologyVersion() != null, e)); | ||
shouldStreamResponses(currentServerDescription), e)); | ||
throw e; | ||
} | ||
} catch (Throwable t) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.