Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FS-SC
AsapoWorker
Commits
cdc8091c
Commit
cdc8091c
authored
Sep 18, 2020
by
Mikhail Karnevskiy
Browse files
Fix streaming work
parent
01278fdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/AsapoWorker/streamer.py
View file @
cdc8091c
...
...
@@ -13,7 +13,7 @@ def max_substream(substreams):
return
max
(
int
(
s
)
for
s
in
substreams
if
s
.
isdecimal
())
def
get_new_substream
(
substream_list
,
sender_substream_list
):
def
get_new_substream
(
substream_list
,
sender_substream_list
,
substream
):
if
sender_substream_list
is
None
:
return
None
new_seubstreams
=
list
(
set
(
substream_list
)
...
...
@@ -27,7 +27,9 @@ def get_new_substream(substream_list, sender_substream_list):
def
has_newer_substream
(
substream
,
substream_list
,
metadata_substream_list
,
sender_substream_list
=
None
):
if
sender_substream_list
:
return
get_new_substream
(
substream_list
,
sender_substream_list
)
is
not
None
return
(
get_new_substream
(
substream_list
,
sender_substream_list
,
substream
)
is
not
None
)
else
:
# a newer substream is ready, when it has data and metadata
max_substream_number
=
max_substream
(
substream_list
)
...
...
@@ -130,7 +132,7 @@ class Streamer:
return
try
:
sender_substream_list
=
self
.
receiv
er
.
get_substream_list
()
sender_substream_list
=
self
.
worker
.
send
er
.
get_substream_list
()
except
StreamError
:
sender_substream_list
=
None
...
...
@@ -165,7 +167,8 @@ class Streamer:
if
(
has_data
or
newer_has_data
)
and
self
.
end_of_stream_callback
:
# call the callback only once
new_substream
=
get_new_substream
(
substream_list
,
sender_substream_list
)
new_substream
=
get_new_substream
(
substream_list
,
sender_substream_list
,
self
.
receiver
.
substream
)
self
.
end_of_stream_callback
(
self
.
receiver
.
substream
,
new_substream
)
self
.
end_of_stream_callback
=
None
...
...
Write
Preview
Supports
Markdown
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