Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
coco
Commits
f3c22dd5
Commit
f3c22dd5
authored
Nov 22, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] 上传录像完成
parent
94b942bb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
app.py
coco/app.py
+8
-3
models.py
coco/models.py
+5
-4
record.py
coco/record.py
+1
-1
No files found.
coco/app.py
View file @
f3c22dd5
...
@@ -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
()
coco/models.py
View file @
f3c22dd5
...
@@ -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
{}
\n
Input: {}
\n
Output: {}
\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
[:]
...
...
coco/record.py
View file @
f3c22dd5
...
@@ -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
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment