Hi team.
We are facing a problem in that we can’t rerun our cron job workflows with new changes.
2022-12-07T13:25:26.945Z [worker] info: Workflow execution already started
2022-12-07T13:25:26.957Z [worker] info: Workflow execution already started
2022-12-07T13:25:26.971Z [worker] info: Workflow execution already started
Every time when we deploy our changes to temporal we run the start script. Where we are running our worker and then start the cron job workflows.
const handle = await client.start('workflowName', {
args: [currencyCode],
taskQueue: 'TaskQueue',
workflowId: workflowIdPrefix + currencyCode,
cronSchedule: `${minute} * * * *`,
});
workerLogger.info(`workflow ${handle.workflowId} started`);
We try to cancel running workflows and run them one more time. But facing the same issue. Temporal cancel existing workflows and can’t run a new one. Do we have any idea how to rerun the temporal cron job?
async function terminateWorkflow(currencyCode: CurrencyCode) {
const client = await getWorkflowClient();
const handle = client.getHandle(workflowIdPrefix + currencyCode);
try {
await handle.cancel();
workerLogger.info(`workflow ${handle.workflowId} terminated`);
} catch {
workerLogger.info(
`workflow ${handle.workflowId} execution already completed`
);
}
}