From c6a92083a8621e50a7b5410ea9909d4e4233da0a Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 13 Nov 2023 07:53:13 +0000 Subject: [PATCH] Fix pid parsing on release lock --- backend/src/database.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/database.ts b/backend/src/database.ts index 655dad47c..0638aa319 100644 --- a/backend/src/database.ts +++ b/backend/src/database.ts @@ -140,9 +140,9 @@ import { execSync } from 'child_process'; public releasePidLock(): void { const filePath = path.join(config.DATABASE.PID_DIR || __dirname, `/mempool-${config.DATABASE.DATABASE}.pid`); if (fs.existsSync(filePath)) { - const pid = fs.readFileSync(filePath).toString(); + const pid = parseInt(fs.readFileSync(filePath, 'utf-8')); // only release our own pid file - if (pid === `${process.pid}`) { + if (pid === process.pid) { fs.unlinkSync(filePath); } }