mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: do not count normal dispatcher exits as crashes
The close handler called recordCrash() unconditionally, even for exit code 0 (normal MAX_REQUESTS restart). After 5 normal cycles within 60s the dispatcher was permanently disabled. Now only non-zero exits count.
This commit is contained in:
@@ -216,12 +216,14 @@ function startDispatcher(): ChildProcess | null {
|
||||
dispatcherReady = false;
|
||||
});
|
||||
|
||||
child.on("close", () => {
|
||||
child.on("close", (code) => {
|
||||
for (const [id, req] of pendingRequests.entries()) {
|
||||
req.reject(new Error("Python dispatcher exited unexpectedly"));
|
||||
pendingRequests.delete(id);
|
||||
}
|
||||
recordCrash();
|
||||
if (code !== 0) {
|
||||
recordCrash();
|
||||
}
|
||||
dispatcher = null;
|
||||
dispatcherReady = false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user