Fix env save-and-restart by deferring PM2 restart until after HTTP response.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -335,7 +335,11 @@
|
||||
}
|
||||
|
||||
async function restartInstance() {
|
||||
await fetchJson("/api/admin/restart", { method: "POST" });
|
||||
try {
|
||||
await fetchJson("/api/admin/restart", { method: "POST" });
|
||||
} catch (_) {
|
||||
// 重启会中断当前 HTTP 连接;只要后续 health 恢复即视为成功.
|
||||
}
|
||||
const deadline = Date.now() + 90000;
|
||||
while (Date.now() < deadline) {
|
||||
await new Promise((r) => setTimeout(r, 2000));
|
||||
|
||||
Reference in New Issue
Block a user