Skip to content

Commit

Permalink
add await of res
Browse files Browse the repository at this point in the history
  • Loading branch information
KSDaemon committed Jan 10, 2025
1 parent 73bced9 commit d9e3c80
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/cubejs-api-gateway/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1812,17 +1812,15 @@ class ApiGateway {
if (props.queryType === 'multi') {
// We prepare the final json result on native side
const resultMulti = new ResultMultiWrapper(results, { queryType, slowQuery });
return res(resultMulti);
await res(resultMulti);
} else {
// We prepare the full final json result on native side
return res(results[0]);
await res(results[0]);
}
} catch (e: any) {
this.handleError({
e, context, query, res, requestStarted
});

return null;
}
}

Expand Down Expand Up @@ -1914,7 +1912,7 @@ class ApiGateway {
}];
}

return res(request.streaming ? results[0] : { results });
await res(request.streaming ? results[0] : { results });
} else {
results = await Promise.all(
normalizedQueries.map(async (normalizedQuery, index) => {
Expand Down Expand Up @@ -1948,19 +1946,17 @@ class ApiGateway {
);

if (request.streaming) {
return res(results[0]);
await res(results[0]);
} else {
// We prepare the final json result on native side
const resultArray = new ResultArrayWrapper(results);
return res(resultArray);
await res(resultArray);
}
}
} catch (e: any) {
this.handleError({
e, context, query, res, requestStarted
});

return null;
}
}

Expand Down

0 comments on commit d9e3c80

Please sign in to comment.