mirror of https://github.com/openclaw/openclaw.git
refactor: share memory concurrency config
This commit is contained in:
parent
a5f0f66427
commit
ae7121d534
|
|
@ -49,9 +49,8 @@ describe("memory manager cache hydration", () => {
|
||||||
await fs.rm(workspaceDir, { recursive: true, force: true });
|
await fs.rm(workspaceDir, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("deduplicates concurrent manager creation for the same cache key", async () => {
|
function createMemoryConcurrencyConfig(indexPath: string): OpenClawConfig {
|
||||||
const indexPath = path.join(workspaceDir, "index.sqlite");
|
return {
|
||||||
const cfg = {
|
|
||||||
agents: {
|
agents: {
|
||||||
defaults: {
|
defaults: {
|
||||||
workspace: workspaceDir,
|
workspace: workspaceDir,
|
||||||
|
|
@ -65,6 +64,11 @@ describe("memory manager cache hydration", () => {
|
||||||
list: [{ id: "main", default: true }],
|
list: [{ id: "main", default: true }],
|
||||||
},
|
},
|
||||||
} as OpenClawConfig;
|
} as OpenClawConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
it("deduplicates concurrent manager creation for the same cache key", async () => {
|
||||||
|
const indexPath = path.join(workspaceDir, "index.sqlite");
|
||||||
|
const cfg = createMemoryConcurrencyConfig(indexPath);
|
||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
Array.from(
|
Array.from(
|
||||||
|
|
@ -85,20 +89,7 @@ describe("memory manager cache hydration", () => {
|
||||||
|
|
||||||
it("drains in-flight manager creation during global teardown", async () => {
|
it("drains in-flight manager creation during global teardown", async () => {
|
||||||
const indexPath = path.join(workspaceDir, "index.sqlite");
|
const indexPath = path.join(workspaceDir, "index.sqlite");
|
||||||
const cfg = {
|
const cfg = createMemoryConcurrencyConfig(indexPath);
|
||||||
agents: {
|
|
||||||
defaults: {
|
|
||||||
workspace: workspaceDir,
|
|
||||||
memorySearch: {
|
|
||||||
provider: "openai",
|
|
||||||
model: "mock-embed",
|
|
||||||
store: { path: indexPath, vector: { enabled: false } },
|
|
||||||
sync: { watch: false, onSessionStart: false, onSearch: false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
list: [{ id: "main", default: true }],
|
|
||||||
},
|
|
||||||
} as OpenClawConfig;
|
|
||||||
|
|
||||||
hoisted.providerDelayMs = 100;
|
hoisted.providerDelayMs = 100;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue