pollForResult() — dead-code-hunter Function Reference
Architecture documentation for the pollForResult() function in integration.test.ts from the dead-code-hunter codebase.
Entity Profile
Dependency Diagram
graph TD 4b4f276e_c3df_c3fc_dbfb_84efda3fc34c["pollForResult()"] e24069d3_01df_965c_4846_7b5d20bf2edd["integration.test.ts"] 4b4f276e_c3df_c3fc_dbfb_84efda3fc34c -->|defined in| e24069d3_01df_965c_4846_7b5d20bf2edd style 4b4f276e_c3df_c3fc_dbfb_84efda3fc34c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/__tests__/integration.test.ts lines 12–43
async function pollForResult(
api: DefaultApi,
idempotencyKey: string,
zipBlob: Blob,
timeoutMs = 120_000
): Promise<DeadCodeAnalysisResponse> {
const startTime = Date.now();
for (let attempt = 1; attempt <= 30; attempt++) {
const response: DeadCodeAnalysisResponseAsync = await api.generateDeadCodeAnalysis({
idempotencyKey,
file: zipBlob,
});
if (response.status === 'completed' && response.result) {
return response.result;
}
if (response.status === 'failed') {
throw new Error(`Analysis job failed: ${response.error || 'unknown error'}`);
}
if (Date.now() - startTime >= timeoutMs) {
throw new Error(`Polling timed out after ${timeoutMs}ms`);
}
const retryMs = (response.retryAfter ?? 10) * 1000;
await new Promise(resolve => setTimeout(resolve, retryMs));
}
throw new Error('Max polling attempts exceeded');
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does pollForResult() do?
pollForResult() is a function in the dead-code-hunter codebase, defined in src/__tests__/integration.test.ts.
Where is pollForResult() defined?
pollForResult() is defined in src/__tests__/integration.test.ts at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free