Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix check in maybeReplaceWithLessBusyConnection
The inequality in maybeReplaceWithLessBusyConnection was supposed to check if the least busy connection has at least 20% less inflight requests compared to heavy loaded connection. However, this check was incorrect: if alternative == nil || alternative.AvailableStreams() * 120 > c.AvailableStreams() * 100 { return c } Since "alternative" is the least busy connection, by definition it has the largest number of available streams. Therefore, alternative.AvailableStreams() > c.AvailableStreams() is always true. This commit rewrites the condition by using a number of in use streams (inflight requests). The inequality now correctly checks is the least busy connection has at least 20% less in use streams compared to the heavy loaded connection.
- Loading branch information