chore(lint): parallelize Claude persisted agents lookup

Replace sequential parseClaudeSessionDescriptor loop with Promise.all
to fix no-await-in-loop warning.
This commit is contained in:
Mohamed Boudra
2026-04-24 03:18:16 +07:00
parent 01f3502935
commit 316253aed6

View File

@@ -1193,19 +1193,14 @@ export class ClaudeAgentClient implements AgentClient {
} }
const limit = options?.limit ?? 20; const limit = options?.limit ?? 20;
const candidates = await collectRecentClaudeSessions(projectsRoot, limit * 3); const candidates = await collectRecentClaudeSessions(projectsRoot, limit * 3);
const descriptors: PersistedAgentDescriptor[] = []; const parsed = await Promise.all(
candidates.map((candidate) =>
for (const candidate of candidates) { parseClaudeSessionDescriptor(candidate.path, candidate.mtime),
const descriptor = await parseClaudeSessionDescriptor(candidate.path, candidate.mtime); ),
if (descriptor) { );
descriptors.push(descriptor); return parsed
} .filter((descriptor): descriptor is PersistedAgentDescriptor => descriptor !== null)
if (descriptors.length >= limit) { .slice(0, limit);
break;
}
}
return descriptors;
} }
async isAvailable(): Promise<boolean> { async isAvailable(): Promise<boolean> {