Skip to content

Commit 6b47f4f

Browse files
committed
fix(testing-drivers): guard the jobs poll in hookPreaggs like its twin
The `await preAggregationsJobsGET` was the last unguarded one in this file. The orchestrator and compiler errors it can raise became unhandled rejections thrown out of an async interval callback, so `stop()` never ran, the poll kept going, and the build died 60s later on `timeout.` with the real error never printed - the failure mode already removed from `buildPreaggs`. The two poll loops now have the same shape. postgres-core green again: 6 passed, snapshots unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VDVoT5YNCrewPZ87jyzmkF
1 parent c900c12 commit 6b47f4f

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

‎packages/cubejs-testing-drivers/src/helpers/buildPreaggs.ts‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,33 @@ export async function hookPreaggs(
181181
let timeout: NodeJS.Timeout;
182182
let stop: () => void;
183183
const interval = setInterval(async () => {
184-
const selectors: {
184+
let selectors: {
185185
token: string,
186186
table: string,
187187
status: string,
188188
selector: any,
189-
}[] = await core
190-
.apiGateway()
191-
.preAggregationsJobsGET(
192-
{
193-
authInfo: { tenantId: 'tenant1' },
194-
securityContext: { tenantId: 'tenant1' },
195-
requestId: 'XXX',
196-
},
197-
tokens,
198-
);
199-
189+
}[];
190+
// Without this the orchestrator and compiler errors this call can raise are
191+
// unhandled rejections thrown out of an async interval callback: `stop()`
192+
// never runs, the poll carries on, and the build dies 60s later on `timeout.`
193+
// with the real error never printed. Mirrors the guard in `buildPreaggs`.
194+
try {
195+
selectors = await core
196+
.apiGateway()
197+
.preAggregationsJobsGET(
198+
{
199+
authInfo: { tenantId: 'tenant1' },
200+
securityContext: { tenantId: 'tenant1' },
201+
requestId: 'XXX',
202+
},
203+
tokens,
204+
);
205+
} catch (e) {
206+
stop();
207+
reject(`Cube pre-aggregations build failed: ${e}`);
208+
return;
209+
}
210+
200211
const failed = selectors.find((info) => info.status.indexOf('failure') >= 0);
201212
if (failed) {
202213
stop();

0 commit comments

Comments
 (0)