feat: rename to scheduleWorfklow

This commit is contained in:
karishmas6
2024-09-12 19:38:05 +05:30
parent a4dd08b814
commit c997ca7f9a

View File

@@ -28,7 +28,7 @@ const workflowQueue = new Queue('workflow', { connection });
export const worker = new Worker('workflow', async job => { export const worker = new Worker('workflow', async job => {
const { fileName, runId } = job.data; const { fileName, runId } = job.data;
try { try {
const result = await runWorkflow(fileName, runId); const result = await scheduleWorkflow(fileName, runId);
return result; return result;
} catch (error) { } catch (error) {
console.error('Error running workflow:', error); console.error('Error running workflow:', error);
@@ -56,7 +56,7 @@ worker.on('failed', async (job: any, err) => {
console.log('Worker and queue have been closed after failure.'); console.log('Worker and queue have been closed after failure.');
}); });
async function runWorkflow(fileName: string, runId: string) { async function scheduleWorkflow(fileName: string, runId: string) {
if (!runId) { if (!runId) {
runId = uuid(); runId = uuid();
} }
@@ -169,4 +169,4 @@ async function executeRun(fileName: string, runId: string) {
return false; return false;
} }
} }
export { workflowQueue, runWorkflow }; export { workflowQueue, scheduleWorkflow };