Skip to content

Commit 44c912b

Browse files
committed
Set default c to 4, make a single constant
1 parent f6494f0 commit 44c912b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

app/backend/prepdocs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ async def main(strategy: Strategy, setup_index: bool = True):
314314
parser.add_argument(
315315
"--concurrency",
316316
type=int,
317-
default=10,
317+
default=FileStrategy.DEFAULT_CONCURRENCY,
318318
help="Max. number of concurrent tasks to run for processing files (file strategy only) (default: 10)",
319319
)
320320

app/backend/prepdocslib/filestrategy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class FileStrategy(Strategy):
4242
Strategy for ingesting documents into a search service from files stored either locally or in a data lake storage account
4343
"""
4444

45+
DEFAULT_CONCURRENCY = 4
46+
4547
def __init__(
4648
self,
4749
list_file_strategy: ListFileStrategy,
@@ -57,7 +59,7 @@ def __init__(
5759
category: Optional[str] = None,
5860
use_content_understanding: bool = False,
5961
content_understanding_endpoint: Optional[str] = None,
60-
concurrency: int = 10,
62+
concurrency: int = DEFAULT_CONCURRENCY,
6163
):
6264
self.list_file_strategy = list_file_strategy
6365
self.blob_manager = blob_manager
@@ -118,6 +120,7 @@ async def process_file_worker(semaphore: asyncio.Semaphore, file: File):
118120

119121
if self.document_action == DocumentAction.Add:
120122
files = self.list_file_strategy.list()
123+
logger.info("Running with concurrency: %d", self.concurrency)
121124
semaphore = asyncio.Semaphore(self.concurrency)
122125
tasks = [process_file_worker(semaphore, file) async for file in files]
123126
await asyncio.gather(*tasks)

0 commit comments

Comments
 (0)