Skip to content

Commit a2aec88

Browse files
committed
code polishment in PreAggregationLoadCache class
1 parent 9d966b6 commit a2aec88

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationLoadCache.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,17 @@ type PreAggregationLoadCacheOptions = {
1717
};
1818

1919
export class PreAggregationLoadCache {
20-
private driverFactory: DriverFactory;
20+
private readonly driverFactory: DriverFactory;
2121

2222
private queryCache: QueryCache;
2323

24-
// eslint-disable-next-line no-use-before-define
2524
private preAggregations: PreAggregations;
2625

27-
private queryResults: any;
26+
private readonly queryResults: any;
2827

29-
private externalDriverFactory: any;
28+
private readonly externalDriverFactory: any;
3029

31-
private requestId: any;
30+
private readonly requestId: any;
3231

3332
private versionEntries: { [redisKey: string]: Promise<VersionEntriesObj> };
3433

@@ -41,9 +40,9 @@ export class PreAggregationLoadCache {
4140
// Make it per data source key in case load cache scope is broaden.
4241
private queryStageState: any;
4342

44-
private dataSource: string;
43+
private readonly dataSource: string;
4544

46-
private tablePrefixes: string[] | null;
45+
private readonly tablePrefixes: string[] | null;
4746

4847
public constructor(
4948
clientFactory: DriverFactory,
@@ -64,7 +63,7 @@ export class PreAggregationLoadCache {
6463
this.tableColumnTypes = {};
6564
}
6665

67-
protected async tablesFromCache(preAggregation, forceRenew?) {
66+
protected async tablesFromCache(preAggregation, forceRenew: boolean = false) {
6867
let tables = forceRenew ? null : await this.queryCache.getCacheDriver().get(this.tablesCachePrefixKey(preAggregation));
6968
if (!tables) {
7069
tables = await this.preAggregations.getLoadCacheQueue(this.dataSource).executeInQueue(
@@ -145,14 +144,11 @@ export class PreAggregationLoadCache {
145144
);
146145
// It presumes strong consistency guarantees for external pre-aggregation tables ingestion
147146
if (!preAggregation.external) {
148-
// eslint-disable-next-line
149-
const [active, toProcess, queries] = await this.fetchQueryStageState();
147+
const [,, queries] = await this.fetchQueryStageState();
150148
const targetTableNamesInQueue = (Object.keys(queries))
151-
// eslint-disable-next-line no-use-before-define
152149
.map(q => PreAggregations.targetTableName(queries[q].query.newVersionEntry));
153150

154151
versionEntries = versionEntries.filter(
155-
// eslint-disable-next-line no-use-before-define
156152
e => targetTableNamesInQueue.indexOf(PreAggregations.targetTableName(e)) === -1
157153
);
158154
}

0 commit comments

Comments
 (0)