Skip to content

Commit

Permalink
fix(cmn): update log lines for service shutdown
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
smartcontracts committed Mar 11, 2022
1 parent 5ae1504 commit f776105
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/good-knives-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/common-ts': patch
---

Update log lines for service shutdown
4 changes: 3 additions & 1 deletion packages/common-ts/src/base-service/base-service-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export abstract class BaseServiceV2<

// Gracefully handle stop signals.
const stop = async (signal: string) => {
this.logger.info(`stopping service`, { signal })
this.logger.info(`stopping service with signal`, { signal })
await this.stop()
process.exit(0)
}
Expand Down Expand Up @@ -263,9 +263,11 @@ export abstract class BaseServiceV2<
this.running = false

// Wait until the main loop has finished.
this.logger.info('stopping service, waiting for main loop to finish')
while (!this.done) {
await sleep(1000)
}
this.logger.info('main loop finished, goodbye!')
}

/**
Expand Down

0 comments on commit f776105

Please sign in to comment.