mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2530 from murgatroid99/benchmark_stop_delay
benchmark: Delay shutdown in quitWorker
This commit is contained in:
commit
426768d6cd
|
@ -74,6 +74,20 @@ function main() {
|
||||||
});
|
});
|
||||||
serverWorkerStream.on('status', (status) => {
|
serverWorkerStream.on('status', (status) => {
|
||||||
console.log('Received server worker status ' + JSON.stringify(status));
|
console.log('Received server worker status ' + JSON.stringify(status));
|
||||||
|
clientWorker.quitWorker({}, (error, response) => {
|
||||||
|
if (error) {
|
||||||
|
console.log('Received error on clientWorker.quitWorker:', error);
|
||||||
|
} else {
|
||||||
|
console.log('Received response from clientWorker.quitWorker');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
serverWorker.quitWorker({}, (error, response) => {
|
||||||
|
if (error) {
|
||||||
|
console.log('Received error on serverWorker.quitWorker:', error);
|
||||||
|
} else {
|
||||||
|
console.log('Received response from serverWorker.quitWorker');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,12 @@ module.exports = function WorkerServiceImpl(benchmark_impl, server) {
|
||||||
|
|
||||||
this.quitWorker = function quitWorker(call, callback) {
|
this.quitWorker = function quitWorker(call, callback) {
|
||||||
callback(null, {});
|
callback(null, {});
|
||||||
server.tryShutdown(function() {});
|
/* Due to https://github.com/nodejs/node/issues/42713, tryShutdown acts
|
||||||
|
* like forceShutdown on some Node versions. So, delay calling tryShutdown
|
||||||
|
* until after done handling this request. */
|
||||||
|
setTimeout(() => {
|
||||||
|
server.tryShutdown(function() {});
|
||||||
|
}, 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.runClient = function runClient(call) {
|
this.runClient = function runClient(call) {
|
||||||
|
|
Loading…
Reference in New Issue