Merge pull request #10487 from Budibase/fix/automation-log-issue
Potential fix for automation log issue
This commit is contained in:
commit
cfae0f6811
4 changed files with 14 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue