Spaces:
Sleeping
Sleeping
Commit
·
54517df
1
Parent(s):
d93fcf9
unstable fix 2
Browse files- LoadBalancer.py +3 -4
LoadBalancer.py
CHANGED
|
@@ -34,9 +34,8 @@ class LoadBalancer:
|
|
| 34 |
if not os.path.exists(self.CACHE_DIR):
|
| 35 |
os.makedirs(self.CACHE_DIR)
|
| 36 |
|
| 37 |
-
# Initialize file structure
|
| 38 |
self.file_structure = indexer()
|
| 39 |
-
asyncio.run(self.start_prefetching()) # Run the async method directly
|
| 40 |
|
| 41 |
# Start polling and file checking in separate threads
|
| 42 |
polling_thread = Thread(target=self.start_polling)
|
|
@@ -90,8 +89,8 @@ class LoadBalancer:
|
|
| 90 |
time.sleep(120) # Wait for 2 minutes
|
| 91 |
current_file_structure = indexer()
|
| 92 |
if current_file_structure != self.previous_file_structure:
|
| 93 |
-
#
|
| 94 |
-
asyncio.
|
| 95 |
self.previous_file_structure = current_file_structure
|
| 96 |
else:
|
| 97 |
logging.info("No new content detected.")
|
|
|
|
| 34 |
if not os.path.exists(self.CACHE_DIR):
|
| 35 |
os.makedirs(self.CACHE_DIR)
|
| 36 |
|
| 37 |
+
# Initialize file structure
|
| 38 |
self.file_structure = indexer()
|
|
|
|
| 39 |
|
| 40 |
# Start polling and file checking in separate threads
|
| 41 |
polling_thread = Thread(target=self.start_polling)
|
|
|
|
| 89 |
time.sleep(120) # Wait for 2 minutes
|
| 90 |
current_file_structure = indexer()
|
| 91 |
if current_file_structure != self.previous_file_structure:
|
| 92 |
+
# Schedule the prefetching task
|
| 93 |
+
asyncio.get_event_loop().create_task(self.start_prefetching())
|
| 94 |
self.previous_file_structure = current_file_structure
|
| 95 |
else:
|
| 96 |
logging.info("No new content detected.")
|