MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / wait_for_reboot

Method wait_for_reboot

mod/project/node/nodeutil/base.py:1917–1932  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1915 repo.set_wait_reboot(self.node_server_ip, True)
1916
1917 def wait_for_reboot():
1918 # wait 等待服务器重启成功, 超时时间默认为 10 分钟
1919 wait_for = time.time() + 600
1920 time.sleep(3)
1921 while time.time() < wait_for:
1922 if self.test_conn() == "": # 无错误时表示重启成功
1923 repo.set_wait_reboot(self.node_server_ip, False)
1924 from mod.project.node.dbutil import ServerNodeDB
1925 node_data = ServerNodeDB().find_node(api_key=self.api_key, app_key=self.app_key.to_string())
1926 if node_data:
1927 monitor_node_once(node_data)
1928 return {"status": True, "msg": "重启服务器成功"}
1929 time.sleep(3)
1930 public.print_log("等待服务器重启中... {}".format(wait_for - time.time()))
1931 repo.set_wait_reboot(self.node_server_ip, False)
1932 return {"status": False, "msg": "重启服务器失败, 已超过10分钟未能检测到服务器信息"}
1933
1934 t = threading.Thread(target=wait_for_reboot, daemon=True)
1935 t.start()

Callers

nothing calls this directly

Calls 9

test_connMethod · 0.95
ServerNodeDBClass · 0.90
monitor_node_onceFunction · 0.85
timeMethod · 0.80
set_wait_rebootMethod · 0.80
find_nodeMethod · 0.80
to_stringMethod · 0.45
print_logMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected