feat: Add published_at column to flows and adjust update flow status

This commit is contained in:
Faruk AYDIN
2022-08-17 20:44:16 +03:00
committed by Ali BARIN
parent c4a3f19bba
commit 5fb988ae2d
3 changed files with 20 additions and 2 deletions

View File

@@ -36,9 +36,13 @@ const updateFlowStatus = async (
const interval = trigger.interval;
const repeatOptions = {
cron: interval || EVERY_15_MINUTES_CRON,
}
};
if (flow.active) {
flow = await flow.$query().patchAndFetch({
published_at: new Date().toISOString(),
});
await processorQueue.add(
JOB_NAME,
{ flowId: flow.id },
@@ -49,7 +53,7 @@ const updateFlowStatus = async (
);
} else {
const repeatableJobs = await processorQueue.getRepeatableJobs();
const job = repeatableJobs.find(job => job.id === flow.id);
const job = repeatableJobs.find((job) => job.id === flow.id);
await processorQueue.removeRepeatableByKey(job.key);
}