Fixlinting
This commit is contained in:
@@ -7,6 +7,7 @@ from dotenv import load_dotenv
|
|||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
|
||||||
class TokenPayload(BaseModel):
|
class TokenPayload(BaseModel):
|
||||||
sub: str # Username
|
sub: str # Username
|
||||||
exp: datetime # Expiration time
|
exp: datetime # Expiration time
|
||||||
|
@@ -29,7 +29,9 @@ preload_app = True
|
|||||||
worker_class = "uvicorn.workers.UvicornWorker"
|
worker_class = "uvicorn.workers.UvicornWorker"
|
||||||
|
|
||||||
# Other Gunicorn configurations
|
# Other Gunicorn configurations
|
||||||
timeout = int(os.getenv("TIMEOUT", 150 * 2)) # Default 150s *2 to match run_with_gunicorn.py
|
timeout = int(
|
||||||
|
os.getenv("TIMEOUT", 150 * 2)
|
||||||
|
) # Default 150s *2 to match run_with_gunicorn.py
|
||||||
keepalive = int(os.getenv("KEEPALIVE", 5)) # Default 5s
|
keepalive = int(os.getenv("KEEPALIVE", 5)) # Default 5s
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
|
@@ -482,16 +482,20 @@ async def run_scanning_process(rag: LightRAG, doc_manager: DocumentManager):
|
|||||||
|
|
||||||
# Process files in batches
|
# Process files in batches
|
||||||
for i in range(0, total_files, batch_size):
|
for i in range(0, total_files, batch_size):
|
||||||
batch_files = new_files[i:i+batch_size]
|
batch_files = new_files[i : i + batch_size]
|
||||||
batch_num = i // batch_size + 1
|
batch_num = i // batch_size + 1
|
||||||
total_batches = (total_files + batch_size - 1) // batch_size
|
total_batches = (total_files + batch_size - 1) // batch_size
|
||||||
|
|
||||||
logger.info(f"Processing batch {batch_num}/{total_batches} with {len(batch_files)} files")
|
logger.info(
|
||||||
|
f"Processing batch {batch_num}/{total_batches} with {len(batch_files)} files"
|
||||||
|
)
|
||||||
await pipeline_index_files(rag, batch_files)
|
await pipeline_index_files(rag, batch_files)
|
||||||
|
|
||||||
# Log progress
|
# Log progress
|
||||||
processed = min(i + batch_size, total_files)
|
processed = min(i + batch_size, total_files)
|
||||||
logger.info(f"Processed {processed}/{total_files} files ({processed/total_files*100:.1f}%)")
|
logger.info(
|
||||||
|
f"Processed {processed}/{total_files} files ({processed/total_files*100:.1f}%)"
|
||||||
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error during scanning process: {str(e)}")
|
logger.error(f"Error during scanning process: {str(e)}")
|
||||||
|
@@ -95,7 +95,11 @@ class UnifiedLock(Generic[T]):
|
|||||||
return self
|
return self
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If main lock acquisition fails, release the async lock if it was acquired
|
# If main lock acquisition fails, release the async lock if it was acquired
|
||||||
if not self._is_async and self._async_lock is not None and self._async_lock.locked():
|
if (
|
||||||
|
not self._is_async
|
||||||
|
and self._async_lock is not None
|
||||||
|
and self._async_lock.locked()
|
||||||
|
):
|
||||||
self._async_lock.release()
|
self._async_lock.release()
|
||||||
|
|
||||||
direct_log(
|
direct_log(
|
||||||
@@ -141,7 +145,11 @@ class UnifiedLock(Generic[T]):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# If main lock release failed but async lock hasn't been released, try to release it
|
# If main lock release failed but async lock hasn't been released, try to release it
|
||||||
if not main_lock_released and not self._is_async and self._async_lock is not None:
|
if (
|
||||||
|
not main_lock_released
|
||||||
|
and not self._is_async
|
||||||
|
and self._async_lock is not None
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
direct_log(
|
direct_log(
|
||||||
f"== Lock == Process {self._pid}: Attempting to release async lock after main lock failure",
|
f"== Lock == Process {self._pid}: Attempting to release async lock after main lock failure",
|
||||||
|
Reference in New Issue
Block a user