File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -28,3 +28,6 @@ export const BATCH_PROCESSING_CONCURRENCY = 10
2828
2929/**Gemini Embedder */
3030export const GEMINI_MAX_ITEM_TOKENS = 2048
31+
32+ /**Embedding Rate Limiting */
33+ export const EMBEDDING_CALL_DELAY_MS = 100 // Pause between embedding API calls to prevent rate limiting
Original file line number Diff line number Diff line change 55 BATCH_SEGMENT_THRESHOLD ,
66 MAX_BATCH_RETRIES ,
77 INITIAL_RETRY_DELAY_MS ,
8+ EMBEDDING_CALL_DELAY_MS ,
89} from "../constants"
910import { createHash } from "crypto"
1011import { RooIgnoreController } from "../../../core/ignore/RooIgnoreController"
@@ -542,6 +543,9 @@ export class FileWatcher implements IFileWatcher {
542543 if ( this . embedder && blocks . length > 0 ) {
543544 const texts = blocks . map ( ( block ) => block . content )
544545 const { embeddings } = await this . embedder . createEmbeddings ( texts )
546+
547+ // Add pause between embedding calls to prevent rate limiting
548+ await new Promise ( resolve => setTimeout ( resolve , EMBEDDING_CALL_DELAY_MS ) )
545549
546550 pointsToUpsert = blocks . map ( ( block , index ) => {
547551 const normalizedAbsolutePath = generateNormalizedAbsolutePath ( block . file_path , this . workspacePath )
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 INITIAL_RETRY_DELAY_MS ,
2424 PARSING_CONCURRENCY ,
2525 BATCH_PROCESSING_CONCURRENCY ,
26+ EMBEDDING_CALL_DELAY_MS ,
2627} from "../constants"
2728import { isPathInIgnoredDirectory } from "../../glob/ignore-utils"
2829import { TelemetryService } from "@roo-code/telemetry"
@@ -344,6 +345,9 @@ export class DirectoryScanner implements IDirectoryScanner {
344345
345346 // Create embeddings for batch
346347 const { embeddings } = await this . embedder . createEmbeddings ( batchTexts )
348+
349+ // Add pause between embedding calls to prevent rate limiting
350+ await new Promise ( resolve => setTimeout ( resolve , EMBEDDING_CALL_DELAY_MS ) )
347351
348352 // Prepare points for Qdrant
349353 const points = batchBlocks . map ( ( block , index ) => {
You can’t perform that action at this time.
0 commit comments