Skip to content

Commit 258d587

Browse files
committed
Increase ThreadPoolExecutor max_workers to 200
Raised the maximum number of workers from 150 to 200 in ai_moderator.py and rule_processor.py to improve parallel processing performance for chunk and rule analysis.
1 parent f0a263a commit 258d587

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

app/services/ai/ai_moderator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def moderate_content(self, content, content_type='text', custom_prompt=None):
326326

327327
# Process all chunks IN PARALLEL for maximum speed
328328
chunk_results = []
329-
with ThreadPoolExecutor(max_workers=min(len(chunks), 150)) as executor:
329+
with ThreadPoolExecutor(max_workers=min(len(chunks), 200)) as executor:
330330
# Submit all chunks at once with context wrapper
331331
future_to_chunk = {
332332
executor.submit(self._context_wrapper, self._analyze_with_custom_prompt, chunk, custom_prompt): i
@@ -375,7 +375,7 @@ def moderate_content(self, content, content_type='text', custom_prompt=None):
375375

376376
# Process all chunks IN PARALLEL for maximum speed
377377
chunk_results = []
378-
with ThreadPoolExecutor(max_workers=min(len(chunks), 150)) as executor:
378+
with ThreadPoolExecutor(max_workers=min(len(chunks), 200)) as executor:
379379
# Submit all chunks at once with context wrapper
380380
future_to_chunk = {
381381
executor.submit(self._context_wrapper, self._run_enhanced_default_moderation, chunk): i

app/services/moderation/rule_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def process_single_ai_rule(rule):
103103
return (rule.id, None)
104104

105105
# Execute in parallel
106-
with ThreadPoolExecutor(max_workers=min(len(ai_rules), 150)) as executor:
106+
with ThreadPoolExecutor(max_workers=min(len(ai_rules), 200)) as executor:
107107
futures = {executor.submit(
108108
process_single_ai_rule, rule): rule for rule in ai_rules}
109109

0 commit comments

Comments
 (0)