File tree Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Expand file tree Collapse file tree 1 file changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -54,26 +54,26 @@ export async function startApp<
54
54
} ) ;
55
55
const logger = shouldPrettyPrint
56
56
? pino (
57
- {
58
- transport : {
59
- target : 'pino-pretty' ,
60
- options : {
61
- colorize : true ,
62
- } ,
57
+ {
58
+ transport : {
59
+ target : 'pino-pretty' ,
60
+ options : {
61
+ colorize : true ,
63
62
} ,
64
63
} ,
65
- destination ,
66
- )
64
+ } ,
65
+ destination ,
66
+ )
67
67
: pino (
68
- {
69
- formatters : {
70
- level ( label ) {
71
- return { level : label } ;
72
- } ,
68
+ {
69
+ formatters : {
70
+ level ( label ) {
71
+ return { level : label } ;
73
72
} ,
74
73
} ,
75
- destination ,
76
- ) ;
74
+ } ,
75
+ destination ,
76
+ ) ;
77
77
78
78
const serviceImpl = service ( ) ;
79
79
assert ( serviceImpl ?. start , 'Service function did not return a conforming object' ) ;
@@ -320,13 +320,15 @@ export async function listen<SLocals extends AnyServiceLocals = ServiceLocals<Co
320
320
}
321
321
logger . info ( 'Graceful shutdown beginning' ) ;
322
322
return new Promise ( ( accept ) => {
323
+ // Per docs https://www.npmjs.com/package/@godaddy /terminus in Kubernetes, wait for readiness threshold
323
324
setTimeout ( accept , 10000 ) ;
324
325
} ) ;
325
326
} ,
326
327
onShutdown ( ) {
327
328
return Promise . resolve ( )
328
329
. then ( ( ) => service . stop ?.( app ) )
329
- . then ( shutdownHandler || Promise . resolve )
330
+ . then ( ( ) => { logger . info ( 'Service stop complete' ) ; } )
331
+ . then ( shutdownHandler || ( ( ) => Promise . resolve ( ) ) )
330
332
. then ( ( ) => logger . info ( 'Graceful shutdown complete' ) )
331
333
. catch ( ( error ) => logger . error ( error , 'Error terminating tracing' ) )
332
334
. then ( ( ) => ( logger as pino . Logger ) . flush ?.( ) ) ;
You can’t perform that action at this time.
0 commit comments