Use fixed .tmp suffix for writeSettings temp file

The mutex already serializes all writes, so the PID-based temp name
is unnecessary. A fixed suffix matches writeStore and avoids orphaned
temp files after a crash (a restarted process picks a new PID).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-12 23:35:29 +00:00
parent 06d692e87d
commit 82e40fb370
+1 -1
View File
@@ -111,7 +111,7 @@ function readSettings(): AdapterSettings {
function writeSettings(settings: AdapterSettings): void {
ensureDirs();
const tmpPath = `${ADAPTER_SETTINGS_PATH}.${process.pid}.tmp`;
const tmpPath = `${ADAPTER_SETTINGS_PATH}.tmp`;
fs.writeFileSync(tmpPath, JSON.stringify(settings, null, 2), "utf-8");
fs.renameSync(tmpPath, ADAPTER_SETTINGS_PATH);
settingsCache = settings;