privateone commited on
Commit
dc6febb
·
1 Parent(s): 8fde8ae

Slight Edit

Browse files
FileStream/server/API/downloads.py CHANGED
@@ -25,12 +25,17 @@ async def stream_handler(request: web.Request):
25
  try:
26
  path = request.match_info["path"]
27
  return await media_streamer(request, path, "FAST")
 
28
  except InvalidHash as e:
 
29
  raise web.HTTPForbidden(text=e.message)
 
30
  except FIleNotFound as e:
31
  raise web.HTTPNotFound(text=e.message)
 
32
  except (AttributeError, BadStatusLine, ConnectionResetError):
33
  pass # Handle expected errors silently
 
34
  except Exception as e:
35
  logging.error(f"Error while streaming file: {str(e)}")
36
  traceback.print_exc()
 
25
  try:
26
  path = request.match_info["path"]
27
  return await media_streamer(request, path, "FAST")
28
+
29
  except InvalidHash as e:
30
+
31
  raise web.HTTPForbidden(text=e.message)
32
+
33
  except FIleNotFound as e:
34
  raise web.HTTPNotFound(text=e.message)
35
+
36
  except (AttributeError, BadStatusLine, ConnectionResetError):
37
  pass # Handle expected errors silently
38
+
39
  except Exception as e:
40
  logging.error(f"Error while streaming file: {str(e)}")
41
  traceback.print_exc()
FileStream/utils/FileProcessors/custom_dl.py CHANGED
@@ -29,7 +29,7 @@ class ByteStreamer:
29
  self.clean_timer = 30 * 60 # Cache cleanup timer set to 30 minutes
30
  self.client: Client = client
31
  self.cached_file_ids: Dict[str, FileId] = {} # Cache to store file properties by db_id
32
- self.last_activity: float = Optional[float] # Track last activity time for the client
33
  asyncio.create_task(self.clean_cache()) # Start the cache cleanup task
34
 
35
  def update_last_activity(self):
 
29
  self.clean_timer = 30 * 60 # Cache cleanup timer set to 30 minutes
30
  self.client: Client = client
31
  self.cached_file_ids: Dict[str, FileId] = {} # Cache to store file properties by db_id
32
+ self.last_activity: float = asyncio.get_event_loop().time() # Track last activity time for the client
33
  asyncio.create_task(self.clean_cache()) # Start the cache cleanup task
34
 
35
  def update_last_activity(self):