core: Apply ManagedChannelImpl's updateBalancingState() immediately

ffcc360ba adjusted updateBalancingState() to require being run within
the sync context. However, it still queued the work into the sync
context, which was unnecessary. This re-entering the sync context
unnecessarily delays the new state from being used.
This commit is contained in:
Eric Anderson 2025-03-06 07:57:32 -08:00
parent a6a041e415
commit ca4819ac6d
1 changed files with 11 additions and 17 deletions

View File

@ -1388,9 +1388,7 @@ final class ManagedChannelImpl extends ManagedChannel implements
syncContext.throwIfNotInThisSynchronizationContext();
checkNotNull(newState, "newState");
checkNotNull(newPicker, "newPicker");
final class UpdateBalancingState implements Runnable {
@Override
public void run() {
if (LbHelperImpl.this != lbHelper || panicMode) {
return;
}
@ -1403,10 +1401,6 @@ final class ManagedChannelImpl extends ManagedChannel implements
channelStateManager.gotoState(newState);
}
}
}
syncContext.execute(new UpdateBalancingState());
}
@Override
public void refreshNameResolution() {