Merge pull request #10487 from Budibase/fix/automation-log-issue
Potential fix for automation log issue
This commit is contained in:
commit
cfae0f6811
|
@ -40,6 +40,12 @@ function logging(queue: Queue, jobQueue: JobQueue) {
|
||||||
case JobQueue.APP_BACKUP:
|
case JobQueue.APP_BACKUP:
|
||||||
eventType = "app-backup-event"
|
eventType = "app-backup-event"
|
||||||
break
|
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")) {
|
if (process.env.NODE_DEBUG?.includes("bull")) {
|
||||||
queue
|
queue
|
||||||
|
|
|
@ -34,8 +34,6 @@ function parseIntSafe(number?: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let inThread = false
|
|
||||||
|
|
||||||
const environment = {
|
const environment = {
|
||||||
// important - prefer app port to generic port
|
// important - prefer app port to generic port
|
||||||
PORT: process.env.APP_PORT || process.env.PORT,
|
PORT: process.env.APP_PORT || process.env.PORT,
|
||||||
|
@ -95,12 +93,8 @@ const environment = {
|
||||||
isProd: () => {
|
isProd: () => {
|
||||||
return !isDev()
|
return !isDev()
|
||||||
},
|
},
|
||||||
// used to check if already in a thread, don't thread further
|
|
||||||
setInThread: () => {
|
|
||||||
inThread = true
|
|
||||||
},
|
|
||||||
isInThread: () => {
|
isInThread: () => {
|
||||||
return inThread
|
return process.env.FORKED_PROCESS
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,12 @@ export class Thread {
|
||||||
const workerOpts: any = {
|
const workerOpts: any = {
|
||||||
autoStart: true,
|
autoStart: true,
|
||||||
maxConcurrentWorkers: this.count,
|
maxConcurrentWorkers: this.count,
|
||||||
|
workerOptions: {
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
FORKED_PROCESS: "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if (opts.timeoutMs) {
|
if (opts.timeoutMs) {
|
||||||
this.timeoutMs = opts.timeoutMs
|
this.timeoutMs = opts.timeoutMs
|
||||||
|
|
|
@ -25,11 +25,9 @@ function makeVariableKey(queryId: string, variable: string) {
|
||||||
|
|
||||||
export function threadSetup() {
|
export function threadSetup() {
|
||||||
// don't run this if not threading
|
// don't run this if not threading
|
||||||
if (env.isTest() || env.DISABLE_THREADING) {
|
if (env.isTest() || env.DISABLE_THREADING || !env.isInThread()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// when thread starts, make sure it is recorded
|
|
||||||
env.setInThread()
|
|
||||||
db.init()
|
db.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue