惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
G
Google Developers Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
有赞技术团队
有赞技术团队
Vercel News
Vercel News
MongoDB | Blog
MongoDB | Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
I
InfoQ
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
The Cloudflare Blog
B
Blog
C
Check Point Blog
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
U
Unit 42
D
Docker
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
博客园 - Franky
A
About on SuperTechFans

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(memory): abort timed-out embedding requests (#82770) ...
steipete · 2026-05-17 · via Recent Commits to openclaw:main

@@ -111,6 +111,34 @@ export function resolveMemoryIndexConcurrency(params: {

111111

return params.providerId === "ollama" ? 1 : EMBEDDING_INDEX_CONCURRENCY;

112112

}

113113114+

export async function runEmbeddingOperationWithTimeout<T>(params: {

115+

timeoutMs: number;

116+

message: string;

117+

run: (signal: AbortSignal) => Promise<T>;

118+

}): Promise<T> {

119+

const controller = new AbortController();

120+

if (!Number.isFinite(params.timeoutMs) || params.timeoutMs <= 0) {

121+

return await params.run(controller.signal);

122+

}

123+

let timer: NodeJS.Timeout | null = null;

124+

const timeoutPromise = new Promise<never>((_, reject) => {

125+

timer = setTimeout(() => {

126+

const error = new Error(params.message);

127+

reject(error);

128+

controller.abort(error);

129+

}, params.timeoutMs);

130+

timer.unref?.();

131+

});

132+

try {

133+

const operation = params.run(controller.signal);

134+

return (await Promise.race([operation, timeoutPromise])) as T;

135+

} finally {

136+

if (timer) {

137+

clearTimeout(timer);

138+

}

139+

}

140+

}

141+114142

export abstract class MemoryManagerEmbeddingOps extends MemoryManagerSyncOps {

115143

protected abstract batchFailureCount: number;

116144

protected abstract batchFailureLastError?: string;

@@ -304,11 +332,11 @@ export abstract class MemoryManagerEmbeddingOps extends MemoryManagerSyncOps {

304332

items: texts.length,

305333

timeoutMs,

306334

});

307-

return await this.withTimeout(

308-

provider.embedBatch(texts),

335+

return await runEmbeddingOperationWithTimeout({

309336

timeoutMs,

310-

`memory embeddings batch timed out after ${Math.round(timeoutMs / 1000)}s`,

311-

);

337+

message: `memory embeddings batch timed out after ${Math.round(timeoutMs / 1000)}s`,

338+

run: async (signal) => await provider.embedBatch(texts, { signal }),

339+

});

312340

},

313341

isRetryable: isRetryableMemoryEmbeddingError,

314342

waitForRetry: async (delayMs) => {

@@ -336,11 +364,11 @@ export abstract class MemoryManagerEmbeddingOps extends MemoryManagerSyncOps {

336364

items: inputs.length,

337365

timeoutMs,

338366

});

339-

return await this.withTimeout(

340-

embedBatchInputs(inputs),

367+

return await runEmbeddingOperationWithTimeout({

341368

timeoutMs,

342-

`memory embeddings batch timed out after ${Math.round(timeoutMs / 1000)}s`,

343-

);

369+

message: `memory embeddings batch timed out after ${Math.round(timeoutMs / 1000)}s`,

370+

run: async (signal) => await embedBatchInputs(inputs, { signal }),

371+

});

344372

},

345373

isRetryable: isRetryableMemoryEmbeddingError,

346374

waitForRetry: async (delayMs) => {

@@ -371,16 +399,17 @@ export abstract class MemoryManagerEmbeddingOps extends MemoryManagerSyncOps {

371399

}

372400373401

protected async embedQueryWithTimeout(text: string): Promise<number[]> {

374-

if (!this.provider) {

402+

const provider = this.provider;

403+

if (!provider) {

375404

throw new Error("Cannot embed query in FTS-only mode (no embedding provider)");

376405

}

377406

const timeoutMs = this.resolveEmbeddingTimeout("query");

378-

log.debug("memory embeddings: query start", { provider: this.provider.id, timeoutMs });

379-

return await this.withTimeout(

380-

this.provider.embedQuery(text),

407+

log.debug("memory embeddings: query start", { provider: provider.id, timeoutMs });

408+

return await runEmbeddingOperationWithTimeout({

381409

timeoutMs,

382-

`memory embeddings query timed out after ${Math.round(timeoutMs / 1000)}s`,

383-

);

410+

message: `memory embeddings query timed out after ${Math.round(timeoutMs / 1000)}s`,

411+

run: async (signal) => await provider.embedQuery(text, { signal }),

412+

});

384413

}

385414386415

protected async withTimeout<T>(