Spaces:
Paused
Paused
lanny xu
commited on
Commit
·
6f931c4
1
Parent(s):
d6633c7
optimize query speed
Browse files- run_debug.py +12 -3
run_debug.py
CHANGED
|
@@ -77,16 +77,25 @@ def run_all_in_one():
|
|
| 77 |
print("🎉 成功建立隧道!")
|
| 78 |
print(f"👉 公网访问地址: {url_match.group(0)}")
|
| 79 |
print("="*60 + "\n")
|
| 80 |
-
#
|
|
|
|
|
|
|
| 81 |
|
| 82 |
# 检查服务器是否还在运行
|
| 83 |
if server_process.poll() is not None:
|
| 84 |
print("❌ 警告:服务器进程意外退出!")
|
| 85 |
break
|
| 86 |
|
| 87 |
-
#
|
| 88 |
-
print("ℹ️
|
| 89 |
while True:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
time.sleep(1)
|
| 91 |
|
| 92 |
except KeyboardInterrupt:
|
|
|
|
| 77 |
print("🎉 成功建立隧道!")
|
| 78 |
print(f"👉 公网访问地址: {url_match.group(0)}")
|
| 79 |
print("="*60 + "\n")
|
| 80 |
+
# 找到链接后,我们不仅不退出,还要跳出读取循环进入纯等待模式
|
| 81 |
+
# 否则继续读取可能会阻塞或读到 EOF 导致退出
|
| 82 |
+
break
|
| 83 |
|
| 84 |
# 检查服务器是否还在运行
|
| 85 |
if server_process.poll() is not None:
|
| 86 |
print("❌ 警告:服务器进程意外退出!")
|
| 87 |
break
|
| 88 |
|
| 89 |
+
# 循环结束后,保持主线程存活
|
| 90 |
+
print("ℹ️ 服务已就绪,主线程进入保活模式 (按 Stop 停止)...")
|
| 91 |
while True:
|
| 92 |
+
# 持续监控子进程状态
|
| 93 |
+
if server_process.poll() is not None:
|
| 94 |
+
print("❌ 警告:服务器进程意外退出!")
|
| 95 |
+
break
|
| 96 |
+
if tunnel_process.poll() is not None:
|
| 97 |
+
print("❌ 警告:隧道进程意外退出!")
|
| 98 |
+
break
|
| 99 |
time.sleep(1)
|
| 100 |
|
| 101 |
except KeyboardInterrupt:
|