Commit f7761058 authored by Kelvin Fichter's avatar Kelvin Fichter

fix(cmn): update log lines for service shutdown

Improves the log lines within BaseServiceV2 when the service is being
shut down. Follows the pattern already laid out in the main() function
which will log when key events happen.
parent 5ae15042
---
'@eth-optimism/common-ts': patch
---
Update log lines for service shutdown
...@@ -207,7 +207,7 @@ export abstract class BaseServiceV2< ...@@ -207,7 +207,7 @@ export abstract class BaseServiceV2<
// Gracefully handle stop signals. // Gracefully handle stop signals.
const stop = async (signal: string) => { const stop = async (signal: string) => {
this.logger.info(`stopping service`, { signal }) this.logger.info(`stopping service with signal`, { signal })
await this.stop() await this.stop()
process.exit(0) process.exit(0)
} }
...@@ -263,9 +263,11 @@ export abstract class BaseServiceV2< ...@@ -263,9 +263,11 @@ export abstract class BaseServiceV2<
this.running = false this.running = false
// Wait until the main loop has finished. // Wait until the main loop has finished.
this.logger.info('stopping service, waiting for main loop to finish')
while (!this.done) { while (!this.done) {
await sleep(1000) await sleep(1000)
} }
this.logger.info('main loop finished, goodbye!')
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment