mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-19 15:23:12 +09:00
Save controller plugin data on the save hook (#513)
exp_groups and exp_roles only saved their datastores on shutdown, and exp_scenario saved the player store but not the feature store on the save hook. The controller runs the save hook on its autosave interval, so a crash or kill lost every change since the controller started. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
82abc2c332
commit
20ca539af3
5 files changed
+33
-5
No files matched your search
@@ -216,6 +216,17 @@ t.test("controller plugin", t2 => {
|
||||
);
|
||||
});
|
||||
|
||||
t2.test("features are saved on the save hook", async t3 => {
|
||||
const databaseDirectory = t3.testdir();
|
||||
const { updateFeature, save } = await startPlugin(t3, { withPlugins: false, databaseDirectory });
|
||||
await updateFeature(new messages.FeatureUpdateRequest("afk_kick", false, { afk_minutes: 5 }));
|
||||
await save();
|
||||
|
||||
const { listFeatures } = await startPlugin(t3, { withPlugins: false, databaseDirectory });
|
||||
const record = await getFeature(listFeatures, "afk_kick");
|
||||
t3.strictSame([record.enabled, record.values], [false, { afk_minutes: 5 }], "the saved record is loaded");
|
||||
});
|
||||
|
||||
t2.test("stored features are kept across restarts", async t3 => {
|
||||
const databaseDirectory = t3.testdir();
|
||||
const { updateFeature, shutdown } = await startPlugin(t3, { withPlugins: false, databaseDirectory });
|
||||
|
||||
Reference in new issue
Block a user