Spaces:
Running
Running
Commit
·
4718e29
1
Parent(s):
6a13ef1
Testing Changes
Browse files
FileStream/server/Functions/downloader.py
CHANGED
@@ -29,17 +29,19 @@ async def media_streamer(request: web.Request, db_id: str, speed: str):
|
|
29 |
logging.info(f"Client {client['index']} is now serving {request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
30 |
|
31 |
# Use an existing ByteStreamer or create a new one
|
32 |
-
tg_connect = ACTIVE_CLIENTS.get(client['client'], None)
|
33 |
|
34 |
-
if
|
35 |
logging.info(f"Creating new ByteStreamer object for client {client['index']}")
|
36 |
-
tg_connect =
|
37 |
-
ACTIVE_CLIENTS[client['client']] = tg_connect
|
38 |
|
39 |
else:
|
40 |
-
tg_connect.
|
|
|
41 |
logging.info(f"Using cached ByteStreamer object for client {client['index']}")
|
42 |
|
|
|
|
|
43 |
try:
|
44 |
# Fetch file properties once and use it throughout
|
45 |
logging.debug("Fetching file properties")
|
|
|
29 |
logging.info(f"Client {client['index']} is now serving {request.headers.get('X-FORWARDED-FOR', request.remote)}")
|
30 |
|
31 |
# Use an existing ByteStreamer or create a new one
|
32 |
+
#tg_connect = ACTIVE_CLIENTS.get(client['client'], None)
|
33 |
|
34 |
+
if client['client'] in ACTIVE_CLIENTS:
|
35 |
logging.info(f"Creating new ByteStreamer object for client {client['index']}")
|
36 |
+
tg_connect = ACTIVE_CLIENTS(client['client'])
|
|
|
37 |
|
38 |
else:
|
39 |
+
tg_connect = utils.ByteStreamer(client['client'])
|
40 |
+
ACTIVE_CLIENTS[client['client']] = tg_connect
|
41 |
logging.info(f"Using cached ByteStreamer object for client {client['index']}")
|
42 |
|
43 |
+
tg_connect.update_last_activity()
|
44 |
+
|
45 |
try:
|
46 |
# Fetch file properties once and use it throughout
|
47 |
logging.debug("Fetching file properties")
|