1
0
Fork 0
mirror of synced 2024-07-27 09:06:08 +12:00

Merge pull request #10487 from Budibase/fix/automation-log-issue

Potential fix for automation log issue
This commit is contained in:
Michael Drury 2023-05-05 11:59:25 +01:00 committed by GitHub
commit cfae0f6811
4 changed files with 14 additions and 10 deletions

View file

@ -40,6 +40,12 @@ function logging(queue: Queue, jobQueue: JobQueue) {
case JobQueue.APP_BACKUP:
eventType = "app-backup-event"
break
case JobQueue.AUDIT_LOG:
eventType = "audit-log-event"
break
case JobQueue.SYSTEM_EVENT_QUEUE:
eventType = "system-event"
break
}
if (process.env.NODE_DEBUG?.includes("bull")) {
queue

View file

@ -34,8 +34,6 @@ function parseIntSafe(number?: string) {
}
}
let inThread = false
const environment = {
// important - prefer app port to generic port
PORT: process.env.APP_PORT || process.env.PORT,
@ -95,12 +93,8 @@ const environment = {
isProd: () => {
return !isDev()
},
// used to check if already in a thread, don't thread further
setInThread: () => {
inThread = true
},
isInThread: () => {
return inThread
return process.env.FORKED_PROCESS
},
}

View file

@ -39,6 +39,12 @@ export class Thread {
const workerOpts: any = {
autoStart: true,
maxConcurrentWorkers: this.count,
workerOptions: {
env: {
...process.env,
FORKED_PROCESS: "1",
},
},
}
if (opts.timeoutMs) {
this.timeoutMs = opts.timeoutMs

View file

@ -25,11 +25,9 @@ function makeVariableKey(queryId: string, variable: string) {
export function threadSetup() {
// don't run this if not threading
if (env.isTest() || env.DISABLE_THREADING) {
if (env.isTest() || env.DISABLE_THREADING || !env.isInThread()) {
return
}
// when thread starts, make sure it is recorded
env.setInThread()
db.init()
}