feat: Configure app service to restart automatically in Docker Compose and replace file-based restart trigger with process.exit().
This commit is contained in:
@@ -9,7 +9,6 @@ const execAsync = promisify(exec);
|
||||
|
||||
// Constants
|
||||
const STALE_CONTEXT_MS = 10 * 60 * 1000; // 10 minutes
|
||||
const RESTART_TRIGGER_FILE = ".restart_trigger";
|
||||
|
||||
export interface RestartContext {
|
||||
channelId: string;
|
||||
@@ -77,12 +76,9 @@ export class UpdateService {
|
||||
// Run without awaiting - it may kill the process immediately
|
||||
exec(process.env.RESTART_COMMAND).unref();
|
||||
} else {
|
||||
// Fallback to writing a trigger file (avoids polluting source code)
|
||||
try {
|
||||
await writeFile(RESTART_TRIGGER_FILE, Date.now().toString());
|
||||
} catch (err) {
|
||||
console.error("Failed to write restart trigger:", err);
|
||||
}
|
||||
// Fallback: exit the process and let Docker/PM2/systemd restart it
|
||||
// Small delay to allow any pending I/O to complete
|
||||
setTimeout(() => process.exit(0), 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user