Fix identical updatedAtMs values in datastore

The assumption with the subscription system is that new updates will
always increment the updatedAtMs value to something greater than what
has been seen before.  This might not happen if the system clock is
adjusted, or updates are sent so fast that Date.now() returns the same
value.

Fix these edge cases so that the timestamp is always incremented.
This commit is contained in:
Hornwitser committed 2026-03-09 17:41:11 +01:00
1 parent 2399fb9d15
commit b0595a6502
3 files changed
+121 -21

No files matched your search

+6
View File
@@ -37,6 +37,12 @@ describe("controller/User", function () {
user.saveRecord();
assert(user.updatedAtMs > prev);
});
it("should always increment updatedAtMs even if called in quick succession", function () {
user.saveRecord();
let prev = user.updatedAtMs;
user.saveRecord();
assert(user.updatedAtMs > prev, "updatedAtMs did not increase");
});
});
describe(".set()", function () {