We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffb4260 commit 24ccef6Copy full SHA for 24ccef6
lib/utils/settings.js
@@ -46,6 +46,8 @@ export function getSetting (key) {
46
return settings[key]
47
}
48
49
+let pendingSave = false
50
+
51
/**
52
* @template {keyof typeof settings} Key
53
* @param {Key} key
@@ -54,8 +56,14 @@ export function getSetting (key) {
54
56
*/
55
57
export function updateSetting (key, value) {
58
settings[key] = value
- fs.writeFileSync(
- settingsPath,
59
- Buffer.from(JSON.stringify(settings)).toString('base64')
60
- )
+ if (!pendingSave) {
+ pendingSave = true
61
+ process.nextTick(() => {
62
+ pendingSave = false
63
+ fs.writeFileSync(
64
+ settingsPath,
65
+ Buffer.from(JSON.stringify(settings)).toString('base64')
66
+ )
67
+ })
68
+ }
69
0 commit comments