mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
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:
1 parent
2399fb9d15
commit
b0595a6502
3 files changed
+121
-21
No files matched your search
@@ -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 () {
|
||||
|
||||
Reference in new issue
Block a user