From b0783d373ac2b3376059623b0c8538969ddd0751 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 30 May 2023 19:16:36 +0100 Subject: [PATCH] Lint --- packages/server/src/automations/logging/index.ts | 4 ++-- packages/server/src/threads/automation.ts | 8 ++++++-- packages/server/src/threads/index.ts | 12 +++++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/server/src/automations/logging/index.ts b/packages/server/src/automations/logging/index.ts index fd47990488..9d16f15a67 100644 --- a/packages/server/src/automations/logging/index.ts +++ b/packages/server/src/automations/logging/index.ts @@ -15,7 +15,7 @@ function sanitiseResults(results: AutomationResults) { } step.outputs = { message, - success: step.outputs.success + success: step.outputs.success, } } } @@ -29,7 +29,7 @@ export async function storeLog( return } const bytes = sizeof(results) - if ((bytes / MB_IN_BYTES) > MAX_LOG_SIZE_MB) { + if (bytes / MB_IN_BYTES > MAX_LOG_SIZE_MB) { sanitiseResults(results) } await automations.logs.storeLog(automation, results) diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index 0d5586c235..60a07dab09 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -507,7 +507,10 @@ export function execute(job: Job, callback: WorkerCallback) { if (!automationId) { 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() // put into automation thread for whole context await context.doInEnvironmentContext(envVars, async () => { @@ -519,7 +522,8 @@ export function execute(job: Job, callback: WorkerCallback) { callback(err) } }) - }}) + }, + }) } export function executeSynchronously(job: Job) { diff --git a/packages/server/src/threads/index.ts b/packages/server/src/threads/index.ts index 6c03e5b464..6afaa9bb4e 100644 --- a/packages/server/src/threads/index.ts +++ b/packages/server/src/threads/index.ts @@ -38,7 +38,9 @@ export class Thread { this.count = opts.count ? opts.count : 1 this.disableThreading = this.shouldDisableThreading() 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 = { autoStart: true, maxConcurrentWorkers: this.count, @@ -57,7 +59,9 @@ export class Thread { this.workers = workerFarm(workerOpts, typeToFile(type), ["execute"]) Thread.workerRefs.push(this.workers) } 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) { worker.execute(job, (err: any, response: any) => { if (err && err.type === "TimeoutError") { - reject( - new Error(`Thread timeout exceeded ${timeout}ms timeout.`) - ) + reject(new Error(`Thread timeout exceeded ${timeout}ms timeout.`)) } else if (err) { reject(err) } else {