mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-07 00:44:49 +00:00
fix(server): reclaim abandoned daemon locks
The supervisor now keeps the pid lock fresh while it owns it. Startup still respects a live PID with a fresh lock, but can reclaim a lock whose owner PID is alive without refreshing it.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
acquirePidLock,
|
||||
PidLockError,
|
||||
releasePidLock,
|
||||
startPidLockHeartbeat,
|
||||
updatePidLock,
|
||||
} from "../src/server/pid-lock.js";
|
||||
import { resolvePaseoHome } from "../src/server/paseo-home.js";
|
||||
@@ -120,11 +121,15 @@ async function main(): Promise<void> {
|
||||
}
|
||||
|
||||
let lockReleased = false;
|
||||
const stopLockHeartbeat = startPidLockHeartbeat(paseoHome, {
|
||||
ownerPid: process.pid,
|
||||
});
|
||||
const releaseLock = async (): Promise<void> => {
|
||||
if (lockReleased) {
|
||||
return;
|
||||
}
|
||||
lockReleased = true;
|
||||
stopLockHeartbeat();
|
||||
await releasePidLock(paseoHome, {
|
||||
ownerPid: process.pid,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user