Lint
This commit is contained in:
parent
ef9fc94728
commit
b0783d373a
|
@ -15,7 +15,7 @@ function sanitiseResults(results: AutomationResults) {
|
||||||
}
|
}
|
||||||
step.outputs = {
|
step.outputs = {
|
||||||
message,
|
message,
|
||||||
success: step.outputs.success
|
success: step.outputs.success,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ export async function storeLog(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const bytes = sizeof(results)
|
const bytes = sizeof(results)
|
||||||
if ((bytes / MB_IN_BYTES) > MAX_LOG_SIZE_MB) {
|
if (bytes / MB_IN_BYTES > MAX_LOG_SIZE_MB) {
|
||||||
sanitiseResults(results)
|
sanitiseResults(results)
|
||||||
}
|
}
|
||||||
await automations.logs.storeLog(automation, results)
|
await automations.logs.storeLog(automation, results)
|
||||||
|
|
|
@ -507,7 +507,10 @@ export function execute(job: Job<AutomationData>, callback: WorkerCallback) {
|
||||||
if (!automationId) {
|
if (!automationId) {
|
||||||
throw new Error("Unable to execute, event doesn't contain automation ID.")
|
throw new Error("Unable to execute, event doesn't contain automation ID.")
|
||||||
}
|
}
|
||||||
return context.doInAutomationContext({ appId, automationId, task: async () => {
|
return context.doInAutomationContext({
|
||||||
|
appId,
|
||||||
|
automationId,
|
||||||
|
task: async () => {
|
||||||
const envVars = await sdkUtils.getEnvironmentVariables()
|
const envVars = await sdkUtils.getEnvironmentVariables()
|
||||||
// put into automation thread for whole context
|
// put into automation thread for whole context
|
||||||
await context.doInEnvironmentContext(envVars, async () => {
|
await context.doInEnvironmentContext(envVars, async () => {
|
||||||
|
@ -519,7 +522,8 @@ export function execute(job: Job<AutomationData>, callback: WorkerCallback) {
|
||||||
callback(err)
|
callback(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}})
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function executeSynchronously(job: Job) {
|
export function executeSynchronously(job: Job) {
|
||||||
|
|
|
@ -38,7 +38,9 @@ export class Thread {
|
||||||
this.count = opts.count ? opts.count : 1
|
this.count = opts.count ? opts.count : 1
|
||||||
this.disableThreading = this.shouldDisableThreading()
|
this.disableThreading = this.shouldDisableThreading()
|
||||||
if (!this.disableThreading) {
|
if (!this.disableThreading) {
|
||||||
console.debug(`[${env.FORKED_PROCESS_NAME}] initialising worker farm type=${type}`)
|
console.debug(
|
||||||
|
`[${env.FORKED_PROCESS_NAME}] initialising worker farm type=${type}`
|
||||||
|
)
|
||||||
const workerOpts: any = {
|
const workerOpts: any = {
|
||||||
autoStart: true,
|
autoStart: true,
|
||||||
maxConcurrentWorkers: this.count,
|
maxConcurrentWorkers: this.count,
|
||||||
|
@ -57,7 +59,9 @@ export class Thread {
|
||||||
this.workers = workerFarm(workerOpts, typeToFile(type), ["execute"])
|
this.workers = workerFarm(workerOpts, typeToFile(type), ["execute"])
|
||||||
Thread.workerRefs.push(this.workers)
|
Thread.workerRefs.push(this.workers)
|
||||||
} else {
|
} else {
|
||||||
console.debug(`[${env.FORKED_PROCESS_NAME}] skipping worker farm type=${type}`)
|
console.debug(
|
||||||
|
`[${env.FORKED_PROCESS_NAME}] skipping worker farm type=${type}`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,9 +80,7 @@ export class Thread {
|
||||||
function fire(worker: any) {
|
function fire(worker: any) {
|
||||||
worker.execute(job, (err: any, response: any) => {
|
worker.execute(job, (err: any, response: any) => {
|
||||||
if (err && err.type === "TimeoutError") {
|
if (err && err.type === "TimeoutError") {
|
||||||
reject(
|
reject(new Error(`Thread timeout exceeded ${timeout}ms timeout.`))
|
||||||
new Error(`Thread timeout exceeded ${timeout}ms timeout.`)
|
|
||||||
)
|
|
||||||
} else if (err) {
|
} else if (err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue