mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 23:24:52 +09:00
Separate updatedAt from mtime in SaveDetails
If a new save is added to the saves list of an instance the current save selected to be loaded by default changes its state without updating the mtime of the file on disk, which in turn means basing the updatedAt property on mtime will not work with caching. Fix by having a separate updatedAt property that is set by the controller whenever the save details changes from the controller's perspective. Noticed-By: @Cooldude2606
This commit is contained in:
1 parent
1ae686b3ea
commit
699ef2c3cb
3 files changed
+12
-4
No files matched your search
@@ -269,12 +269,14 @@ export default class HostConnection extends BaseConnection {
|
||||
}
|
||||
|
||||
async handleInstanceSaveDetailsUpdatesEvent(event: lib.InstanceSaveDetailsUpdatesEvent) {
|
||||
const now = Date.now();
|
||||
const updates: lib.SaveDetails[] = [];
|
||||
for (const save of event.updates) {
|
||||
const existingSave = this._controller.saves.get(save.id);
|
||||
if (existingSave && save.equals(existingSave)) {
|
||||
continue;
|
||||
}
|
||||
save.updatedAt = now;
|
||||
this._controller.saves.set(save.id, save);
|
||||
updates.push(save);
|
||||
}
|
||||
@@ -283,6 +285,7 @@ export default class HostConnection extends BaseConnection {
|
||||
for (const [id, save] of this._controller.saves) {
|
||||
if (save.instanceId === event.instanceId && !updatedSaves.has(id)) {
|
||||
save.isDeleted = true;
|
||||
save.updatedAt = now;
|
||||
updates.push(save);
|
||||
this._controller.saves.delete(id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user