@agimon-ai/po-wake 0.0.1-alpha.19 → 0.0.1-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -584,14 +584,15 @@ function createWake(options) {
|
|
|
584
584
|
if (!last.available || !live()) return false;
|
|
585
585
|
const saved = record(last.entry?.["data"]);
|
|
586
586
|
const due = dueRecords(read);
|
|
587
|
-
|
|
587
|
+
const arm = async () => {
|
|
588
588
|
const next = nextDueAt(read);
|
|
589
589
|
if (next === void 0) await timer.cancel("routine");
|
|
590
590
|
else await timer.schedule("routine", next, preserve);
|
|
591
591
|
return false;
|
|
592
|
-
}
|
|
592
|
+
};
|
|
593
|
+
if (!due.length) return arm();
|
|
593
594
|
const key = routineKey(due);
|
|
594
|
-
if (saved?.["key"] === key && (saved["fired"] === true || saved["fired"] === void 0 && typeof saved["at"] === "number" && saved["at"] <= now())) return
|
|
595
|
+
if (saved?.["key"] === key && (saved["fired"] === true || saved["fired"] === void 0 && typeof saved["at"] === "number" && saved["at"] <= now())) return arm();
|
|
595
596
|
const at = now() + ROUTINE_QUIET_MS;
|
|
596
597
|
await timer.schedule("routine", at, preserve);
|
|
597
598
|
if (live() && !preserve) await session.appendCustomEntry(WAKE_ROUTINE_TYPE, {
|