mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Use logger.exit in expire-deleted user/project scripts (#36169)
* add logger.exit method to avoid logs being lost by process.exit * use logger.exit in expire deleted projects and users scripts * improve comment for EXIT_DELAY Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * convert to async * await logger.exit in expire deleted projects and users scripts --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> GitOrigin-RevId: 020d5cc2755871e5343130029706fe3b1c8e15ee
This commit is contained in:
committed by
Copybot
co-authored by
Copilot Autofix powered by AI
parent
43ea352733
commit
a9a36237aa
@@ -1,4 +1,5 @@
|
||||
const Stream = require('node:stream')
|
||||
const { setTimeout } = require('node:timers/promises')
|
||||
const bunyan = require('bunyan')
|
||||
const GCPManager = require('./gcp-manager')
|
||||
const Serializers = require('./serializers')
|
||||
@@ -11,6 +12,9 @@ const {
|
||||
setLogger: setValidationToolsLogger,
|
||||
} = require('@overleaf/validation-tools')
|
||||
|
||||
// Delay (ms) before exiting to allow final logs to be flushed.
|
||||
const EXIT_DELAY = 500
|
||||
|
||||
const LoggingManager = {
|
||||
/**
|
||||
* @param {string} name - The name of the logger
|
||||
@@ -100,6 +104,16 @@ const LoggingManager = {
|
||||
this.logger.fatal(attributes, message)
|
||||
},
|
||||
|
||||
/**
|
||||
* Exit after a delay to ensure that log messages are flushed
|
||||
* @param {number} code
|
||||
*/
|
||||
|
||||
async exit(code) {
|
||||
await setTimeout(EXIT_DELAY)
|
||||
process.exit(code)
|
||||
},
|
||||
|
||||
_getOutputStreamConfig() {
|
||||
switch (process.env.LOGGING_FORMAT) {
|
||||
case 'gke': {
|
||||
|
||||
Reference in New Issue
Block a user