Yes, reached out. They mentioned they'd get this merged in tomorrow or Monday.
Yes, reached out. They mentioned they'd get this merged in tomorrow or Monday.
setAlarm under the covers. uses storage to figure out and set an alarm for the next event in the schedule. If you bypass the higher-level and instead use or , depending upon where your base class stores it in the constructor, you shouldn't have this problem.
Date.now() every 1000 ms via Date.now()?Date.now()?Date.now() is stale? or are the callbacks just getting executed less frequently than expected?workerd is queuing the setInterval() callbacks. At the moment the interval is added to the queue, it's using that frozen Date.now() time for that microtask, but then they sit in the queue a while. So then once the queue is unblocked, they all run very quickly and you see time as though it is "fast-forwarding"this.schedule(10, 'destroy')this.ctx.storage.deleteAll();this.schedulethis.schedulethis.schedulethis.ctx.storage.setAlarm()this.state.storage.setAlarm()setInterval()setInterval()setInterval(() => {
this.currentTime = Date.now();
tickGame();
}, 1000);let lastTicked = Date.now();
const gameLoop = () => {
const delta = Date.now() - lastTicked; // the *actual* number of ms since last tick
this.currentTime += delta;
doGameLogic();
setTimeout(gameLoop, 1000);
};
gameLoop();