mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 07:24:53 +09:00
Cache ModInfo to reduce startup time (#606)
Store and use a cache of the loaded ModInfo data to mod-info-cache.json in the mods directory during startup. For simplicity this does not cache mods added to the controller or host after startup, these get added to the cache on the next startup.
This commit is contained in:
1 parent
5dcc66034b
commit
7625fd82e3
4 files changed
+49
No files matched your search
@@ -1054,6 +1054,7 @@ describe("Integration of Clusterio", function() {
|
||||
"factorioVersion: 1.1\n" +
|
||||
"dependencies:\n" +
|
||||
`size: ${stat.size}\n` +
|
||||
`mtimeMs: ${stat.mtimeMs}\n` +
|
||||
`sha1: ${hash}\n` +
|
||||
`updatedAtMs: ${stat.mtimeMs}\n` +
|
||||
"isDeleted: false\n",
|
||||
|
||||
@@ -33,6 +33,7 @@ describe("lib/data/ModInfo", function() {
|
||||
check(ModInfo.fromJSON({ dependencies: ["UltraMod", "SuperLib >= 1.00", "! bad-mod"] }));
|
||||
check(ModInfo.fromJSON({ filename: "MyMod_1.0.0.zip" }));
|
||||
check(ModInfo.fromJSON({ size: 1024 }));
|
||||
check(ModInfo.fromJSON({ mtime_ms: new Date(2024, 0, 1).getTime() }));
|
||||
check(ModInfo.fromJSON({ sha1: "verified-as-MyMod" }));
|
||||
check(ModInfo.fromJSON({ is_deleted: true }));
|
||||
|
||||
@@ -49,6 +50,7 @@ describe("lib/data/ModInfo", function() {
|
||||
dependencies: ["UltraMod", "SuperLib >= 1.00", "! bad-mod"],
|
||||
filename: "MyMod_1.0.0.zip",
|
||||
size: 1024,
|
||||
mtime_ms: new Date(2024, 0, 1).getTime(),
|
||||
sha1: "verified-as-MyMod",
|
||||
is_deleted: true,
|
||||
}));
|
||||
@@ -92,6 +94,7 @@ describe("lib/data/ModInfo", function() {
|
||||
dependencies: [],
|
||||
filename: "empty_mod_1.0.0.zip",
|
||||
size: stat.size,
|
||||
mtime_ms: stat.mtimeMs,
|
||||
updated_at_ms: stat.mtimeMs,
|
||||
sha1: hash,
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user