Ver Fonte

[document-updater] trigger graceful shutdown on unhandled error (#31027)

GitOrigin-RevId: dde99528bfbc1d33f392a52fa8eaf5d4e82266b3
Jakob Ackermann há 8 meses atrás
pai
commit
d5936d8566
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      services/document-updater/app.js

+ 5 - 0
services/document-updater/app.js

@@ -299,6 +299,11 @@ for (const signal of [
   process.on(signal, shutdownCleanly(signal))
 }
 
+process.on('uncaughtException', function (err) {
+  logger.error({ err }, 'uncaught exception')
+  shutdownCleanly('uncaughtException')()
+})
+
 function longerTimeout(req, res, next) {
   res.setTimeout(6 * 60 * 1000)
   next()