mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Enhance runExecution function with proactive browser health checks to prevent zombie instances
This commit is contained in:
@@ -452,6 +452,14 @@ async function runExecution(config: WorkerConfig): Promise<WorkerResult> {
|
||||
context = null;
|
||||
}
|
||||
|
||||
// In --single-process mode, closing a context can destabilize the browser.
|
||||
// Proactively check health so the next execution doesn't waste time on a zombie.
|
||||
if (currentBrowser && !currentBrowser.isConnected()) {
|
||||
currentBrowser = null;
|
||||
currentBrowserType = null;
|
||||
currentProxyServer = null;
|
||||
}
|
||||
|
||||
// Convert screenshots from Buffer to base64
|
||||
if (returnObj["screenshots"]) {
|
||||
const screenshots: Record<string, unknown> = returnObj[
|
||||
@@ -485,6 +493,13 @@ async function runExecution(config: WorkerConfig): Promise<WorkerResult> {
|
||||
// ignore cleanup errors
|
||||
}
|
||||
}
|
||||
|
||||
// Proactively detect zombie browser after context cleanup
|
||||
if (currentBrowser && !currentBrowser.isConnected()) {
|
||||
currentBrowser = null;
|
||||
currentBrowserType = null;
|
||||
currentProxyServer = null;
|
||||
}
|
||||
}
|
||||
|
||||
return workerResult;
|
||||
|
||||
Reference in New Issue
Block a user