Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit ef9fc4c

Browse files
committed
Revert "Temporarily disable save on exit"
This reverts commit a04b9ff.
1 parent f12a513 commit ef9fc4c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

nodecg-io-core/extension/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = (nodecg: NodeCG): NodeCGIOCore => {
3232
persistenceManager,
3333
).registerMessageHandlers();
3434

35-
registerExitHandlers(nodecg, bundleManager, instanceManager, serviceManager);
35+
registerExitHandlers(nodecg, bundleManager, instanceManager, serviceManager, persistenceManager);
3636

3737
// We use a extra object instead of returning a object containing all the managers and so on, because
3838
// any loaded bundle would be able to call any (public or private) of the managers which is not intended.
@@ -62,7 +62,12 @@ function onExit(
6262
bundleManager: BundleManager,
6363
instanceManager: InstanceManager,
6464
serviceManager: ServiceManager,
65+
persistenceManager: PersistenceManager,
6566
): void {
67+
// Save everything
68+
// This is especially important if some services update some configs (e.g. updated tokens) and they haven't been saved yet.
69+
persistenceManager.save();
70+
6671
// Unset all service instances in all bundles
6772
const bundles = bundleManager.getBundleDependencies();
6873
for (const bundleName in bundles) {
@@ -99,9 +104,10 @@ function registerExitHandlers(
99104
bundleManager: BundleManager,
100105
instanceManager: InstanceManager,
101106
serviceManager: ServiceManager,
107+
persistenceManager: PersistenceManager,
102108
): void {
103109
const handler = () => {
104-
onExit(nodecg, bundleManager, instanceManager, serviceManager);
110+
onExit(nodecg, bundleManager, instanceManager, serviceManager, persistenceManager);
105111
};
106112

107113
// Normal exit

0 commit comments

Comments
 (0)