Skip to content

Commit d9e3c80

Browse files
committed
add await of res
1 parent 73bced9 commit d9e3c80

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/cubejs-api-gateway/src/gateway.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,17 +1812,15 @@ class ApiGateway {
18121812
if (props.queryType === 'multi') {
18131813
// We prepare the final json result on native side
18141814
const resultMulti = new ResultMultiWrapper(results, { queryType, slowQuery });
1815-
return res(resultMulti);
1815+
await res(resultMulti);
18161816
} else {
18171817
// We prepare the full final json result on native side
1818-
return res(results[0]);
1818+
await res(results[0]);
18191819
}
18201820
} catch (e: any) {
18211821
this.handleError({
18221822
e, context, query, res, requestStarted
18231823
});
1824-
1825-
return null;
18261824
}
18271825
}
18281826

@@ -1914,7 +1912,7 @@ class ApiGateway {
19141912
}];
19151913
}
19161914

1917-
return res(request.streaming ? results[0] : { results });
1915+
await res(request.streaming ? results[0] : { results });
19181916
} else {
19191917
results = await Promise.all(
19201918
normalizedQueries.map(async (normalizedQuery, index) => {
@@ -1948,19 +1946,17 @@ class ApiGateway {
19481946
);
19491947

19501948
if (request.streaming) {
1951-
return res(results[0]);
1949+
await res(results[0]);
19521950
} else {
19531951
// We prepare the final json result on native side
19541952
const resultArray = new ResultArrayWrapper(results);
1955-
return res(resultArray);
1953+
await res(resultArray);
19561954
}
19571955
}
19581956
} catch (e: any) {
19591957
this.handleError({
19601958
e, context, query, res, requestStarted
19611959
});
1962-
1963-
return null;
19641960
}
19651961
}
19661962

0 commit comments

Comments
 (0)