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 candidates = await collectRecentClaudeSessions(projectsRoot, limit * 3);
const descriptors: PersistedAgentDescriptor[] = [];
for (const candidate of candidates) {
const descriptor = await parseClaudeSessionDescriptor(candidate.path, candidate.mtime);
if (descriptor) {
descriptors.push(descriptor);
}
if (descriptors.length >= limit) {
break;
}
}
return descriptors;
const parsed = await Promise.all(
candidates.map((candidate) =>
parseClaudeSessionDescriptor(candidate.path, candidate.mtime),
),
);
return parsed
.filter((descriptor): descriptor is PersistedAgentDescriptor => descriptor !== null)
.slice(0, limit);
}
async isAvailable(): Promise<boolean> {