This commit is contained in:
Davte 2020-04-19 19:33:03 +02:00
parent 60761ebc5e
commit 1f200b30ab
3 changed files with 6 additions and 3 deletions

View File

@ -399,6 +399,7 @@ class Client:
self.print_progress_bar(
progress=new_progress,
bytes_=bytes_sent,
force=(new_progress == 100)
)
print() # New line after progress_bar
writer.close()
@ -431,7 +432,8 @@ class Client:
)
self.print_progress_bar(
progress=new_progress,
bytes_=bytes_received
bytes_=bytes_received,
force=(new_progress == 100)
)
if not input_data:
break

View File

@ -82,6 +82,7 @@ class Server:
continue
input_data = await reader.read(self.buffer_chunk_size)
if connection_token not in self.buffers:
print("Here!")
break
self.buffers[connection_token].append(input_data)
except ConnectionResetError as e:

View File

@ -77,9 +77,9 @@ def timed_action(interval: Union[int, float, datetime.timedelta] = None):
timedelta = interval
def timer(function_to_time):
def timed_function(*args, **kwargs):
def timed_function(*args, force: bool = False, **kwargs):
nonlocal last_call
if now() > last_call + timedelta:
if force or now() > last_call + timedelta:
last_call = now()
return function_to_time(*args, **kwargs)
return