mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:14:34 +00:00
perf(test): trim retry-loop work in embedding batch tests
This commit is contained in:
@@ -169,7 +169,7 @@ describe("memory embedding batches", () => {
|
|||||||
let calls = 0;
|
let calls = 0;
|
||||||
embedBatch.mockImplementation(async (texts: string[]) => {
|
embedBatch.mockImplementation(async (texts: string[]) => {
|
||||||
calls += 1;
|
calls += 1;
|
||||||
if (calls < 3) {
|
if (calls < 2) {
|
||||||
throw new Error("openai embeddings failed: 429 rate limit");
|
throw new Error("openai embeddings failed: 429 rate limit");
|
||||||
}
|
}
|
||||||
return texts.map(() => [0, 1, 0]);
|
return texts.map(() => [0, 1, 0]);
|
||||||
@@ -217,7 +217,7 @@ describe("memory embedding batches", () => {
|
|||||||
setTimeoutSpy.mockRestore();
|
setTimeoutSpy.mockRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(calls).toBe(3);
|
expect(calls).toBe(2);
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
it("retries embeddings on transient 5xx errors", async () => {
|
it("retries embeddings on transient 5xx errors", async () => {
|
||||||
@@ -228,7 +228,7 @@ describe("memory embedding batches", () => {
|
|||||||
let calls = 0;
|
let calls = 0;
|
||||||
embedBatch.mockImplementation(async (texts: string[]) => {
|
embedBatch.mockImplementation(async (texts: string[]) => {
|
||||||
calls += 1;
|
calls += 1;
|
||||||
if (calls < 3) {
|
if (calls < 2) {
|
||||||
throw new Error("openai embeddings failed: 502 Bad Gateway (cloudflare)");
|
throw new Error("openai embeddings failed: 502 Bad Gateway (cloudflare)");
|
||||||
}
|
}
|
||||||
return texts.map(() => [0, 1, 0]);
|
return texts.map(() => [0, 1, 0]);
|
||||||
@@ -276,7 +276,7 @@ describe("memory embedding batches", () => {
|
|||||||
setTimeoutSpy.mockRestore();
|
setTimeoutSpy.mockRestore();
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(calls).toBe(3);
|
expect(calls).toBe(2);
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
it("skips empty chunks so embeddings input stays valid", async () => {
|
it("skips empty chunks so embeddings input stays valid", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user