Skip to content

Commit 01d7e32

Browse files
committed
save the hapi server.stop promise and do not stop the server multiple times
1 parent 123307c commit 01d7e32

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/lifecycle-handler.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,15 @@ class LifecycleHandler {
9898
}
9999
}
100100

101+
/**
102+
* Stop the hapi server.
103+
*/
101104
async onServerStop () {
102-
await this.server.stop(this.shutdownOptions)
105+
if (!this.isStopping) {
106+
this.isStopping = this.server.stop(this.shutdownOptions)
107+
}
108+
109+
return this.isStopping
103110
}
104111
}
105112

0 commit comments

Comments
 (0)