Skip to content

Commit 3d84e16

Browse files
committed
[SPARK-37462][CORE] Avoid unnecessary calculating the number of outstanding fetch requests and RPCS
1 parent fcf636d commit 3d84e16

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
158158
// To avoid a race between TransportClientFactory.createClient() and this code which could
159159
// result in an inactive client being returned, this needs to run in a synchronized block.
160160
synchronized (this) {
161-
boolean hasInFlightRequests = responseHandler.numOutstandingRequests() > 0;
162161
boolean isActuallyOverdue =
163162
System.nanoTime() - responseHandler.getTimeOfLastRequestNs() > requestTimeoutNs;
164163
if (e.state() == IdleState.ALL_IDLE && isActuallyOverdue) {
164+
boolean hasInFlightRequests = responseHandler.numOutstandingRequests() > 0;
165165
if (hasInFlightRequests) {
166166
String address = getRemoteAddress(ctx.channel());
167167
logger.error("Connection to {} has been quiet for {} ms while there are outstanding " +

0 commit comments

Comments
 (0)