Queer European MD passionate about IT
Davte 5 жил өмнө
parent
commit
1f200b30ab

+ 3 - 1
filebridging/client.py

@@ -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

+ 1 - 0
filebridging/server.py

@@ -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:

+ 2 - 2
filebridging/utilities.py

@@ -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