Browse Source

Wrap saveSync in exitHandler in try-catch

Leszek Wiesner 3 years ago
parent
commit
f49b08ee34
1 changed files with 5 additions and 1 deletions
  1. 5 1
      distributor-node/src/app/index.ts

+ 5 - 1
distributor-node/src/app/index.ts

@@ -128,7 +128,11 @@ export class App {
     // Stop the http api
     this.httpApi.stop()
     // Save cache
-    this.stateCache.saveSync()
+    try {
+      this.stateCache.saveSync()
+    } catch (err) {
+      this.logger.error('Failed to save the cache state on exit!', { err })
+    }
     if (signal) {
       // Async exit can be executed
       this.exitGracefully()