Skip to content

Commit

Permalink
fix: getQueryStage throws undefined is not a function
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltiunov committed Dec 21, 2020
1 parent 6b5a176 commit 0de1603
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export class QueryOrchestrator {
const pendingPreAggregationIndex =
(await Promise.all(
(queryBody.preAggregations || [])
.map(p => this.preAggregations.getQueue(p.dataSource).getQueryStage(
PreAggregations.preAggregationQueryCacheKey(p), 10, preAggregationsQueryStageState(p.dataSource)
.map(async p => this.preAggregations.getQueue(p.dataSource).getQueryStage(
PreAggregations.preAggregationQueryCacheKey(p), 10, await preAggregationsQueryStageState(p.dataSource)
))
)).findIndex(p => !!p);
if (pendingPreAggregationIndex === -1) {
Expand All @@ -111,7 +111,7 @@ export class QueryOrchestrator {
const preAggregationStage = await this.preAggregations.getQueue(preAggregation.dataSource).getQueryStage(
PreAggregations.preAggregationQueryCacheKey(preAggregation),
undefined,
preAggregationsQueryStageState(preAggregation.dataSource)
await preAggregationsQueryStageState(preAggregation.dataSource)
);
if (!preAggregationStage) {
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ describe('QueryOrchestrator', () => {
renewQuery: true,
requestId: 'basic'
};
const result = await queryOrchestrator.fetchQuery(query);
const promise = queryOrchestrator.fetchQuery(query);
console.log(await queryOrchestrator.queryStage(query));
const result = await promise;
console.log(result.data[0]);
expect(result.data[0]).toMatch(/orders_number_and_count20191101_kjypcoio_5yftl5il/);
});
Expand Down

0 comments on commit 0de1603

Please sign in to comment.