Skip to content

Commit

Permalink
reproduce the tryShutdown never resolve bug (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Nov 18, 2021
1 parent 7e51441 commit 517b781
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/server/puppet-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ export class PuppetServer {
this.grpcServer = undefined

log.verbose('PuppetServer', 'stop() shuting down gRPC server ...')
// const future = await util.promisify(
// grpcServer.tryShutdown
// .bind(grpcServer),
// )()
const future = await util.promisify(
grpcServer.tryShutdown
.bind(grpcServer),
)()

try {
await new Promise(resolve => setImmediate(resolve))
Expand All @@ -196,7 +196,7 @@ export class PuppetServer {
* FIXME: even after called `forceShutdown()`, the `tryShutdown()` can not resolved.
* commented out the `await` for now to make it work temporary.
*/
// await future
await future

} catch (e) {
log.warn('PuppetServer', 'stop() gRPC shutdown rejection: %s', (e as Error).message)
Expand Down

0 comments on commit 517b781

Please sign in to comment.