File tree Expand file tree Collapse file tree 1 file changed +2
-18
lines changed
xds/src/main/java/io/grpc/xds Expand file tree Collapse file tree 1 file changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -317,27 +317,11 @@ private void updateWeightEdf() {
317317
318318 // verbose work done (requires optimization)
319319 private void updateWeightSS () {
320- int weightedChannelCount = 0 ;
321- double avgWeight = 0 ;
322- for (Subchannel value : list ) {
323- double newWeight = ((WrrSubchannel ) value ).getWeight ();
324- if (newWeight > 0 ) {
325- avgWeight += newWeight ;
326- weightedChannelCount ++;
327- }
328- }
329-
330- if (weightedChannelCount >= 1 ) {
331- avgWeight /= 1.0 * weightedChannelCount ;
332- } else {
333- avgWeight = 1 ;
334- }
335-
336320 float [] newWeights = new float [list .size ()];
337321 for (int i = 0 ; i < list .size (); i ++) {
338322 WrrSubchannel subchannel = (WrrSubchannel ) list .get (i );
339323 double newWeight = subchannel .getWeight ();
340- newWeights [i ] = newWeight > 0 ? (float ) newWeight : ( float ) avgWeight ;
324+ newWeights [i ] = newWeight > 0 ? (float ) newWeight : 0.0f ;
341325 }
342326
343327 StaticStrideScheduler ssScheduler = new StaticStrideScheduler (newWeights );
@@ -485,7 +469,7 @@ static final class StaticStrideScheduler {
485469 double sumWeight = 0 ;
486470 float maxWeight = 0 ;
487471 for (float weight : weights ) {
488- if (weight == 0 ) {
472+ if (Math . abs ( weight - 0.0 ) < 0.0001 ) {
489473 numZeroWeightChannels ++;
490474 }
491475 sumWeight += weight ;
You can’t perform that action at this time.
0 commit comments