mirror of https://github.com/jackwener/wx-cli.git
fix: 清理调试代码 + 提升服务稳定性
- 移除 _debug_log、signal handler、atexit 等调试代码 - 添加 allow_reuse_address 防止重启端口占用 - warmup 线程加外层异常捕获防止静默崩溃 - 恢复启动自动打开浏览器 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>feat/daemon-cli
parent
73598751a0
commit
3b4b811cc3
|
|
@ -1866,6 +1866,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||
|
||||
class ThreadedServer(ThreadingMixIn, HTTPServer):
|
||||
daemon_threads = True
|
||||
allow_reuse_address = True
|
||||
|
||||
|
||||
def main():
|
||||
|
|
@ -1907,6 +1908,7 @@ def main():
|
|||
|
||||
# 后台预热所有 message DB(图片/emoji 解密必需)
|
||||
def _warmup():
|
||||
try:
|
||||
t0 = time.perf_counter()
|
||||
warmup_keys = ["message\\message_resource.db"]
|
||||
for i in range(5):
|
||||
|
|
@ -1920,6 +1922,8 @@ def main():
|
|||
print(f"[warmup] {k} {(time.perf_counter()-t1)*1000:.0f}ms", flush=True)
|
||||
except Exception as e:
|
||||
print(f"[warmup] {k} 失败: {e}", flush=True)
|
||||
except Exception as e:
|
||||
print(f"[warmup] 异常: {e}", flush=True)
|
||||
# 构建 emoji 映射(独立解密,不走 cache)
|
||||
_build_emoji_lookup(keys)
|
||||
print(f"[warmup] 全部完成 {(time.perf_counter()-t0)*1000:.0f}ms", flush=True)
|
||||
|
|
@ -1934,7 +1938,7 @@ def main():
|
|||
|
||||
try:
|
||||
os.system(f'cmd.exe /c start http://localhost:{PORT}')
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue