From 5fed40c4f358cc5dd21894249066cc10b1adaf23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 4 Apr 2026 07:20:03 +0000 Subject: [PATCH] fix: address code review feedback - reset editor timer, fix graceful shutdown timeout Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/283b1454-583c-4cf7-8df8-444f15863b52 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- docs/index.html | 4 ++-- server/proxy/service/subscription-server.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/index.html b/docs/index.html index a1b60f97..2ddf9009 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1944,14 +1944,14 @@ document.getElementById('edNewCh').onclick=function(){ var editorStartTime=null; var editorTimerInterval=null; function startEditorTimer(){ - if(editorTimerInterval)return; + stopEditorTimer(); editorStartTime=Date.now(); editorTimerInterval=setInterval(function(){ var el=document.getElementById('edTimer'); if(!el)return; var elapsed=Math.floor((Date.now()-editorStartTime)/60000); el.textContent='⏱ '+elapsed+'min'; - },10000); + },60000); } function stopEditorTimer(){ if(editorTimerInterval){clearInterval(editorTimerInterval);editorTimerInterval=null} diff --git a/server/proxy/service/subscription-server.js b/server/proxy/service/subscription-server.js index 5fdbb19a..76de93fd 100644 --- a/server/proxy/service/subscription-server.js +++ b/server/proxy/service/subscription-server.js @@ -570,11 +570,12 @@ server.listen(PORT, '127.0.0.1', () => { // Graceful shutdown function gracefulShutdown(signal) { console.log(`\n${signal} received. Shutting down gracefully...`); + const forceExit = setTimeout(() => { process.exit(1); }, 5000); server.close(() => { + clearTimeout(forceExit); console.log('Server closed.'); process.exit(0); }); - setTimeout(() => { process.exit(1); }, 5000); } process.on('SIGTERM', () => gracefulShutdown('SIGTERM')); process.on('SIGINT', () => gracefulShutdown('SIGINT'));