[~] Refactor

This commit is contained in:
Siarhei Siniak 2022-10-22 17:49:25 +03:00
parent f9dcec00a5
commit cbfd726638

@ -299,16 +299,16 @@ class Application:
while True: while True:
if not finished_output: if not finished_output:
try: try:
self.op1(json_data=dict(action='fetch-chunk-started')) #self.op1(json_data=dict(action='fetch-chunk-started'))
chunk_detailed = next(content) chunk_detailed = next(content)
self.op1( #self.op1(
json_data=dict( # json_data=dict(
action='fetch-chunk-done', # action='fetch-chunk-done',
returncode=chunk_detailed[2], # returncode=chunk_detailed[2],
stderr=chunk_detailed[0], # stderr=chunk_detailed[0],
chunk_length=len(chunk_detailed[1]), # chunk_length=len(chunk_detailed[1]),
) # )
) #)
if (len(chunk_detailed[1]) > 0): if (len(chunk_detailed[1]) > 0):
content_chunks.append(chunk_detailed[1]) content_chunks.append(chunk_detailed[1])
except StopIteration: except StopIteration:
@ -327,9 +327,9 @@ class Application:
if len(chunk) > 0: if len(chunk) > 0:
output_stream.sendall(chunk) output_stream.sendall(chunk)
sent_bytes += len(chunk) sent_bytes += len(chunk)
self.op1( #self.op1(
json_data=dict(sent_bytes=sent_bytes) # json_data=dict(sent_bytes=sent_bytes)
) #)
if finished_output and first_output and len(content_chunks) == 0: if finished_output and first_output and len(content_chunks) == 0:
break break