feat: Convert workers to use js files
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Worker } from 'bullmq';
|
||||
import process from 'node:process';
|
||||
|
||||
import * as Sentry from '../helpers/sentry.ee';
|
||||
import redisConfig from '../config/redis';
|
||||
@@ -12,19 +13,13 @@ import {
|
||||
} from '../helpers/remove-job-configuration';
|
||||
import delayAsMilliseconds from '../helpers/delay-as-milliseconds';
|
||||
|
||||
type JobData = {
|
||||
flowId: string;
|
||||
executionId: string;
|
||||
stepId: string;
|
||||
};
|
||||
|
||||
const DEFAULT_DELAY_DURATION = 0;
|
||||
|
||||
export const worker = new Worker(
|
||||
'action',
|
||||
async (job) => {
|
||||
const { stepId, flowId, executionId, computedParameters, executionStep } =
|
||||
await processAction(job.data as JobData);
|
||||
await processAction(job.data);
|
||||
|
||||
if (executionStep.isFailed) return;
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { Worker } from 'bullmq';
|
||||
import process from 'node:process';
|
||||
|
||||
import * as Sentry from '../helpers/sentry.ee';
|
||||
import redisConfig from '../config/redis';
|
||||
import logger from '../helpers/logger';
|
||||
import appConfig from '../config/app';
|
||||
import User from '../models/user';
|
||||
import Execution from '../models/execution';
|
||||
import ExecutionStep from '../models/execution-step';
|
||||
|
||||
export const worker = new Worker(
|
||||
@@ -23,7 +23,7 @@ export const worker = new Worker(
|
||||
.$relatedQuery('executions')
|
||||
.withSoftDeleted()
|
||||
.select('executions.id')
|
||||
).map((execution: Execution) => execution.id);
|
||||
).map((execution) => execution.id);
|
||||
|
||||
await ExecutionStep.query()
|
||||
.withSoftDeleted()
|
@@ -1,4 +1,5 @@
|
||||
import { Worker } from 'bullmq';
|
||||
import process from 'node:process';
|
||||
|
||||
import * as Sentry from '../helpers/sentry.ee';
|
||||
import redisConfig from '../config/redis';
|
||||
@@ -11,7 +12,7 @@ const isCloudSandbox = () => {
|
||||
return appConfig.isCloud && !appConfig.isProd;
|
||||
};
|
||||
|
||||
const isAutomatischEmail = (email: string) => {
|
||||
const isAutomatischEmail = (email) => {
|
||||
return email.endsWith('@automatisch.io');
|
||||
};
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Worker } from 'bullmq';
|
||||
import process from 'node:process';
|
||||
|
||||
import * as Sentry from '../helpers/sentry.ee';
|
||||
import redisConfig from '../config/redis';
|
@@ -1,4 +1,5 @@
|
||||
import { Worker } from 'bullmq';
|
||||
import process from 'node:process';
|
||||
import { DateTime } from 'luxon';
|
||||
import * as Sentry from '../helpers/sentry.ee';
|
||||
import redisConfig from '../config/redis';
|
@@ -1,6 +1,6 @@
|
||||
import { Worker } from 'bullmq';
|
||||
import process from 'node:process';
|
||||
|
||||
import { IJSONObject, ITriggerItem } from '@automatisch/types';
|
||||
import * as Sentry from '../helpers/sentry.ee';
|
||||
import redisConfig from '../config/redis';
|
||||
import logger from '../helpers/logger';
|
||||
@@ -12,18 +12,11 @@ import {
|
||||
REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||
} from '../helpers/remove-job-configuration';
|
||||
|
||||
type JobData = {
|
||||
flowId: string;
|
||||
stepId: string;
|
||||
triggerItem?: ITriggerItem;
|
||||
error?: IJSONObject;
|
||||
};
|
||||
|
||||
export const worker = new Worker(
|
||||
'trigger',
|
||||
async (job) => {
|
||||
const { flowId, executionId, stepId, executionStep } = await processTrigger(
|
||||
job.data as JobData
|
||||
job.data
|
||||
);
|
||||
|
||||
if (executionStep.isFailed) return;
|
Reference in New Issue
Block a user