Skip to content

Commit

Permalink
write perf fix (#18578)
Browse files Browse the repository at this point in the history
Co-authored-by: annie-mac <annie-mac@s-pkges.redmond.corp.microsoft.com>
  • Loading branch information
xinlian12 and annie-mac authored Jan 15, 2021
1 parent 72d14d7 commit 9f51290
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ private boolean offerChannel(final Channel channel) {
private Channel pollChannel() {
ensureInEventLoop();

final Channel first = this.availableChannels.pollLast();
final Channel first = this.availableChannels.pollFirst();

if (first == null) {
return null; // because there are no available channels
Expand All @@ -1182,7 +1182,7 @@ private Channel pollChannel() {

this.availableChannels.offer(first); // because we need a non-null sentinel to stop the search for a channel

for (Channel next = this.availableChannels.pollLast(); next != first; next = this.availableChannels.pollLast()) {
for (Channel next = this.availableChannels.pollFirst(); next != first; next = this.availableChannels.pollFirst()) {
assert next != null : "impossible";

if (next.isActive()) {
Expand Down

0 comments on commit 9f51290

Please sign in to comment.