feat: Implement process worker with bullmq

This commit is contained in:
Faruk AYDIN
2022-03-05 00:15:46 +03:00
committed by Ömer Faruk Aydın
parent b288dc8c35
commit 20e725b590
9 changed files with 194 additions and 3 deletions

View File

@@ -2,6 +2,7 @@ import { GraphQLString, GraphQLNonNull } from 'graphql';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import executeFlowType from '../types/execute-flow';
import Processor from '../../services/processor';
import processorQueue from '../../queues/processor';
type Params = {
stepId: string;
@@ -21,6 +22,12 @@ const executeFlowResolver = async (
const flow = await step.$relatedQuery('flow');
const data = await new Processor(flow, step).run();
// TODO: Use this snippet to execute flows with the background job.
// const data = processorQueue.add('processorJob', {
// flowId: flow.id,
// stepId: step.id,
// });
await step.$query().patch({
status: 'completed',
});