Commit f3c22dd5 authored by ibuler's avatar ibuler

[Feature] 上传录像完成

parent 94b942bb
...@@ -87,13 +87,16 @@ class Coco: ...@@ -87,13 +87,16 @@ class Coco:
self.keep_heartbeat() self.keep_heartbeat()
self.monitor_sessions() self.monitor_sessions()
def keep_heartbeat(self): def heartbeat(self):
def func():
while not self.stop_evt.is_set():
_sessions = [s.to_json() for s in self.sessions] _sessions = [s.to_json() for s in self.sessions]
tasks = self.service.terminal_heartbeat(_sessions) tasks = self.service.terminal_heartbeat(_sessions)
if tasks: if tasks:
self.handle_task(tasks) self.handle_task(tasks)
def keep_heartbeat(self):
def func():
while not self.stop_evt.is_set():
self.heartbeat()
time.sleep(self.config["HEARTBEAT_INTERVAL"]) time.sleep(self.config["HEARTBEAT_INTERVAL"])
thread = threading.Thread(target=func) thread = threading.Thread(target=func)
...@@ -176,9 +179,11 @@ class Coco: ...@@ -176,9 +179,11 @@ class Coco:
def add_session(self, session): def add_session(self, session):
with self.lock: with self.lock:
self.sessions.append(session) self.sessions.append(session)
self.heartbeat()
def remove_session(self, session): def remove_session(self, session):
with self.lock: with self.lock:
self.sessions.remove(session) self.sessions.remove(session)
self.heartbeat()
...@@ -117,11 +117,12 @@ class Server: ...@@ -117,11 +117,12 @@ class Server:
self._input = self._parse_input() self._input = self._parse_input()
else: else:
if not self._in_input_state: if not self._in_input_state:
print("#" * 30 + " 新周期 " + "#" * 30)
self._output = self._parse_output() self._output = self._parse_output()
print(self._input) logger.debug("\n{}\nInput: {}\nOutput: {}\n{}".format(
print(self._output) "#" * 30 + " Command " + "#" * 30,
print("#" * 30 + " End " + "#" * 30) self._input, self._output,
"#" * 30 + " End " + "#" * 30,
))
self.command_queue.put((self._input, self._output)) self.command_queue.put((self._input, self._output))
del self.input_data[:] del self.input_data[:]
del self.output_data[:] del self.output_data[:]
......
...@@ -155,7 +155,7 @@ class ServerReplayRecorder(LocalFileReplayRecorder): ...@@ -155,7 +155,7 @@ class ServerReplayRecorder(LocalFileReplayRecorder):
def push_replay_record(self, archive): def push_replay_record(self, archive):
logger.debug("Start push replay record to server") logger.debug("Start push replay record to server")
return self.app.service.push_session_replay(archive) return self.app.service.push_session_replay(archive, str(self.session.id))
def push_records(self): def push_records(self):
def func(): def func():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment