I want to set a timer for one minute, during the timer keep checking the workflow.stillThere variable every second, if it is not empty, stop the code execution
const timerDuration = luxon.Duration.fromObject({ minutes: 1 });
const endTime = luxon.DateTime.local().plus(timerDuration);
const checkStillThere = async () => {
while (luxon.DateTime.local() < endTime) {
if (workflow.stillThere) {
break;
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
};
await checkStillThere();
It does not seem to be working, could someone please direct me in the right direction?