Remove dashboard-load timing instrumentation

The perf logs were temporary diagnostics used to identify that slow
reloads were caused by a registered remote node timing out in
/projects/across-nodes. Root cause is resolved and the short-circuit
for zero-remote setups (already committed in 7ea60382a) remains.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Fusion
2026-04-19 00:58:05 -07:00
committed by gsxdsm
parent af833c3264
commit 7cb9fd61ba
5 changed files with 60 additions and 31 deletions

View File

@@ -27,9 +27,11 @@ describe("AgentStore — instructions bundle", () => {
} }
createdAgentIds.length = 0; createdAgentIds.length = 0;
store.close();
// Filesystem cleanup last // Filesystem cleanup last
try { try {
await rm(testDir, { recursive: true, force: true }); await rm(testDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
} catch { } catch {
// Ignore cleanup errors // Ignore cleanup errors
} }

View File

@@ -27,9 +27,11 @@ describe("AgentStore — instructions fields", () => {
} }
createdAgentIds.length = 0; createdAgentIds.length = 0;
store.close();
// Filesystem cleanup last // Filesystem cleanup last
try { try {
await rm(testDir, { recursive: true, force: true }); await rm(testDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
} catch { } catch {
// Ignore cleanup errors // Ignore cleanup errors
} }

View File

@@ -35,7 +35,8 @@ describe("AgentStore", () => {
}); });
afterEach(async () => { afterEach(async () => {
await rm(rootDir, { recursive: true, force: true }); store.close();
await rm(rootDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
}); });
// ── init ────────────────────────────────────────────────────────── // ── init ──────────────────────────────────────────────────────────
@@ -80,6 +81,7 @@ describe("AgentStore", () => {
const legacyStore = new AgentStore({ rootDir: legacyRoot }); const legacyStore = new AgentStore({ rootDir: legacyRoot });
await legacyStore.init(); await legacyStore.init();
try {
const run = await legacyStore.getRunDetail("agent-legacy", "run-legacy"); const run = await legacyStore.getRunDetail("agent-legacy", "run-legacy");
expect(run).toMatchObject({ expect(run).toMatchObject({
@@ -91,7 +93,10 @@ describe("AgentStore", () => {
}); });
expect(await legacyStore.importLegacyFileRuns()).toBe(0); expect(await legacyStore.importLegacyFileRuns()).toBe(0);
} finally { } finally {
await rm(legacyRoot, { recursive: true, force: true }); legacyStore.close();
}
} finally {
await rm(legacyRoot, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
} }
}); });
}); });
@@ -1502,6 +1507,10 @@ describe("AgentStore", () => {
taskId = task.id; taskId = task.id;
}); });
afterEach(() => {
taskStore.close();
});
it("checkoutTask acquires a lease and stamps checkedOutAt", async () => { it("checkoutTask acquires a lease and stamps checkedOutAt", async () => {
const updated = await store.checkoutTask(holderId, taskId); const updated = await store.checkoutTask(holderId, taskId);
@@ -2382,11 +2391,14 @@ describe("AgentStore", () => {
const store2 = new AgentStore({ rootDir }); const store2 = new AgentStore({ rootDir });
await store2.init(); await store2.init();
try {
const keys = await store2.listApiKeys(agent.id); const keys = await store2.listApiKeys(agent.id);
expect(keys).toHaveLength(1); expect(keys).toHaveLength(1);
expect(keys[0].id).toBe(key.id); expect(keys[0].id).toBe(key.id);
expect(keys[0].label).toBe("persist"); expect(keys[0].label).toBe("persist");
} finally {
store2.close();
}
}); });
}); });
@@ -2461,7 +2473,7 @@ describe("AgentStore", () => {
// Create a new store instance pointing to the same rootDir // Create a new store instance pointing to the same rootDir
const store2 = new AgentStore({ rootDir }); const store2 = new AgentStore({ rootDir });
await store2.init(); await store2.init();
try {
const found = await store2.getAgent(agent.id); const found = await store2.getAgent(agent.id);
expect(found).not.toBeNull(); expect(found).not.toBeNull();
expect(found!.id).toBe(agent.id); expect(found!.id).toBe(agent.id);
@@ -2473,6 +2485,9 @@ describe("AgentStore", () => {
// Heartbeat history persists too // Heartbeat history persists too
const history = await store2.getHeartbeatHistory(agent.id); const history = await store2.getHeartbeatHistory(agent.id);
expect(history).toHaveLength(1); expect(history).toHaveLength(1);
} finally {
store2.close();
}
}); });
}); });
}); });

View File

@@ -1995,6 +1995,16 @@ export class AgentStore extends EventEmitter {
this.db.bumpLastModified(); this.db.bumpLastModified();
} }
/**
* Close the underlying SQLite connection and release resources.
*/
close(): void {
if (this._db) {
this._db.close();
this._db = null;
}
}
private async withLock<T>(agentId: string, fn: () => Promise<T>): Promise<T> { private async withLock<T>(agentId: string, fn: () => Promise<T>): Promise<T> {
// Get or create lock for this agent // Get or create lock for this agent
let lock = this.locks.get(agentId); let lock = this.locks.get(agentId);

View File

@@ -48,8 +48,8 @@ describe("TaskStore", () => {
afterEach(async () => { afterEach(async () => {
store.close(); store.close();
await rm(rootDir, { recursive: true, force: true }); await rm(rootDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
await rm(globalDir, { recursive: true, force: true }); await rm(globalDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 });
}); });
async function createTestTask(): Promise<Task> { async function createTestTask(): Promise<Task> {