Hi, we are trying use the Alarms API in durable objects. Our pseudo code is below. Our code works, b

Hi, we are trying use the Alarms API in durable objects. Our pseudo code is below. Our code works, but for some reason, the alarm will only fire once (in our case, 60 seconds after the Durable Object code is executed). After the first run of the alarm, the alarm does not fire again. I was under the impression that an Alarm will fire multiple times until it is deleted, very much like a cron. Is the intended activity to fire only once? If not, why does our Alarm only fire once? What is the code to make it like a cron, so it fire for example, every 60 seconds? From what I can tell an Alarm only fires once when the durable function is called? Is there a way to set an ongoing Alarm that continues to fire after the first one is set? async getReceipts(): Promise<any> {

let currentAlarm = await this.ctx.storage.getAlarm();
if (currentAlarm == null) {
this.ctx.storage.setAlarm(Date.now() + 1000 * SECONDS);
}

}
async alarm() {
console.log('We have fired the alarm for Check Receipts! Call the Workflow here!');
}
Was this page helpful?