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:
BastiaanandClaude Opus 5.5 authored and GitHub committed 2026-10-25 21:57:21 +00:00
1 parent 82abc2c332
commit 20ca539af3
5 files changed
+33 -5

No files matched your search

+3 -2
View File
@@ -80,11 +80,12 @@ export class ControllerPlugin {
controller.handle(messages.RoleMappingGetRequest, plugin.handleRoleMappingGetRequest.bind(plugin));
controller.handle(messages.RoleMappingListRequest, plugin.handleRoleMappingListRequest.bind(plugin));
controller.hooks.shutdown.attach(plugin.name, plugin.onShutdown.bind(plugin));
controller.hooks.save.attach(plugin.name, plugin.onSave.bind(plugin));
controller.hooks.shutdown.attach(plugin.name, plugin.onSave.bind(plugin));
return plugin;
}
async onShutdown() {
async onSave() {
await Promise.all([
this.groups.save(),
this.manualAssignments.save(),