Skip to content

Commit 9890d59

Browse files
authored
Merge pull request #2626 from murgatroid99/grpc-js_call_timer_ref_fix
grpc-js: Fix call ref timer handling
2 parents 202a735 + 4dfd8c4 commit 9890d59

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.9.12",
3+
"version": "1.9.13",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/internal-channel.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ export class InternalChannel {
296296
this.currentPicker = picker;
297297
const queueCopy = this.pickQueue.slice();
298298
this.pickQueue = [];
299-
this.callRefTimerUnref();
299+
if (queueCopy.length > 0) {
300+
this.callRefTimerUnref();
301+
}
300302
for (const call of queueCopy) {
301303
call.doPick();
302304
}
@@ -349,11 +351,12 @@ export class InternalChannel {
349351
process.nextTick(() => {
350352
const localQueue = this.configSelectionQueue;
351353
this.configSelectionQueue = [];
352-
this.callRefTimerUnref();
354+
if (localQueue.length > 0) {
355+
this.callRefTimerUnref();
356+
}
353357
for (const call of localQueue) {
354358
call.getConfig();
355359
}
356-
this.configSelectionQueue = [];
357360
});
358361
},
359362
status => {
@@ -380,7 +383,9 @@ export class InternalChannel {
380383
}
381384
const localQueue = this.configSelectionQueue;
382385
this.configSelectionQueue = [];
383-
this.callRefTimerUnref();
386+
if (localQueue.length > 0) {
387+
this.callRefTimerUnref();
388+
}
384389
for (const call of localQueue) {
385390
call.reportResolverError(status);
386391
}

0 commit comments

Comments
 (0)