mirror of
https://github.com/TencentCloud/TencentDB-Agent-Memory
synced 2026-07-10 12:34:27 +00:00
fix(embedding): enable retry backoff for embedding API calls (#173)
MAX_RETRIES was hardcoded to 0, making the existing exponential backoff retry logic dead code. Transient errors (network jitter, 429 rate limits, DNS failures) caused immediate embedding failure, contributing to JSONL/SQLite drift (issue #156). Changed MAX_RETRIES from 0 to 3, matching the retry strategy already used by tcvdb-client.ts. Closes #159 Signed-off-by: WSL_zhangxiaoshuai <zhangxiaoshuai@wsl.com> Co-authored-by: WSL_zhangxiaoshuai <zhangxiaoshuai@wsl.com>
This commit is contained in:
@@ -365,8 +365,11 @@ export class LocalEmbeddingService implements EmbeddingService {
|
||||
/** Max texts per batch (OpenAI limit is 2048, we use a safe value) */
|
||||
const MAX_BATCH_SIZE = 256;
|
||||
|
||||
/** Max retries for API calls */
|
||||
const MAX_RETRIES = 0;
|
||||
/**
|
||||
* Max retries for embedding API calls (transient errors: network, 429, DNS).
|
||||
* Total attempts = MAX_RETRIES + 1. Exponential backoff: 500ms × attempt.
|
||||
*/
|
||||
const MAX_RETRIES = 3;
|
||||
/** Default timeout per API call in milliseconds */
|
||||
const DEFAULT_API_TIMEOUT_MS = 10_000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user