update
This commit is contained in:
@@ -31,6 +31,7 @@ export class EcoDaemon {
|
||||
private logs: string[] = [];
|
||||
private swayStatus: ServiceStatus = { state: 'stopped' };
|
||||
private chromiumStatus: ServiceStatus = { state: 'stopped' };
|
||||
private manualRestartUntil: number = 0; // Timestamp until which auto-restart is disabled
|
||||
|
||||
constructor(config?: Partial<DaemonConfig>) {
|
||||
this.config = {
|
||||
@@ -94,6 +95,9 @@ export class EcoDaemon {
|
||||
return { success: false, message: 'Cannot restart Chromium: Sway is not running' };
|
||||
}
|
||||
|
||||
// Disable auto-restart for 15 seconds to prevent restart loop
|
||||
this.manualRestartUntil = Date.now() + 15000;
|
||||
|
||||
try {
|
||||
// Stop existing Chromium
|
||||
await this.processManager.stopBrowser();
|
||||
@@ -313,8 +317,9 @@ export class EcoDaemon {
|
||||
}
|
||||
|
||||
// If Sway is running but Chromium died, restart Chromium
|
||||
// Skip if manual restart is in progress (prevents restart loop)
|
||||
if (this.swayStatus.state === 'running' && this.chromiumStatus.state === 'running'
|
||||
&& !this.processManager.isBrowserRunning()) {
|
||||
&& !(await this.processManager.isBrowserRunning()) && Date.now() > this.manualRestartUntil) {
|
||||
this.log('Chromium process died, attempting restart...');
|
||||
this.chromiumStatus = { state: 'starting', lastAttempt: new Date().toISOString() };
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user