Openstatus www.openstatus.dev

๐Ÿ•› Schedule next job (#1187)

* schedule next job

* schedule next job

authored by

Thibault Le Ouay and committed by
GitHub
204ebf04 d7d5ef9e

+10 -2
+1 -1
apps/workflows/src/cron/index.ts
··· 75 75 switch (schema.data) { 76 76 case "14days": 77 77 // We send the first email 78 - await Step14Days(Number(userId)); 78 + await Step14Days(Number(userId), Number(initialRun)); 79 79 break; 80 80 case "3days": 81 81 await Step3Days(Number(userId), Number(initialRun));
+9 -1
apps/workflows/src/cron/monitor.ts
··· 186 186 console.log(`user workflow started for ${user.userId}`); 187 187 } 188 188 189 - export async function Step14Days(userId: number) { 189 + export async function Step14Days(userId: number, workFlowRunTimestamp: number) { 190 190 const user = await getUser(userId); 191 191 192 192 // Send email saying we are going to pause the monitors ··· 205 205 lastLogin: new Date(), 206 206 deactivateAt: new Date(new Date().setDate(new Date().getDate() + 14)), 207 207 }), 208 + }); 209 + 210 + await CreateTask({ 211 + parent, 212 + client: client, 213 + step: "3days", 214 + userId: user.id, 215 + initialRun: workFlowRunTimestamp, 208 216 }); 209 217 } 210 218 }