Deploy: 2026-06-24 15:10:09
This commit is contained in:
@@ -21,7 +21,11 @@ const puppeteerConfig = {
|
||||
'--no-first-run',
|
||||
'--disable-gpu',
|
||||
'--disable-web-security',
|
||||
'--disable-features=IsolateOrigins,site-per-process'
|
||||
'--disable-features=IsolateOrigins,site-per-process',
|
||||
'--disable-background-timer-throttling',
|
||||
'--disable-backgrounding-occluded-windows',
|
||||
'--disable-renderer-backgrounding',
|
||||
'--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36'
|
||||
]
|
||||
};
|
||||
|
||||
@@ -39,6 +43,25 @@ for (const p of possiblePaths) {
|
||||
}
|
||||
}
|
||||
|
||||
// Clean Chrome Profile Locks to prevent startup freezes
|
||||
function cleanChromeLocks(sessionKey) {
|
||||
const sessionPath = path.join(SESSIONS_DIR, `session-${sessionKey}`);
|
||||
const lockFiles = [
|
||||
path.join(sessionPath, 'SingletonLock'),
|
||||
path.join(sessionPath, 'Default', 'SingletonLock')
|
||||
];
|
||||
for (const lockFile of lockFiles) {
|
||||
try {
|
||||
if (fs.existsSync(lockFile)) {
|
||||
console.log(`[CLEANUP] Removing dangling lock file for ${sessionKey}: ${lockFile}`);
|
||||
fs.unlinkSync(lockFile);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`[CLEANUP WARNING] Could not remove lock file for ${sessionKey} (${lockFile}):`, err.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function sendWebhook(webhook_url, payload) {
|
||||
try {
|
||||
console.log(`[Webhook] Sending to ${webhook_url} | state=${payload.state}`);
|
||||
@@ -62,6 +85,9 @@ async function startSession(session_key, webhook_url) {
|
||||
|
||||
console.log(`[Session] Starting ${session_key} → webhook: ${webhook_url}`);
|
||||
|
||||
// Clean dangling locks from previous crashes before launching Chrome
|
||||
cleanChromeLocks(session_key);
|
||||
|
||||
const client = new Client({
|
||||
authStrategy: new LocalAuth({
|
||||
clientId: session_key,
|
||||
|
||||
Reference in New Issue
Block a user