Skip to content

Commit 1a53a61

Browse files
committed
a bit of code polishment in PreAggregationLoader class
1 parent a2aec88 commit 1a53a61

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ import { ContinueWaitError } from './ContinueWaitError';
1717
import { LargeStreamWarning } from './StreamObjectsCounter';
1818
import {
1919
getStructureVersion,
20-
InvalidationKeys, LoadPreAggregationResult,
20+
InvalidationKeys,
21+
LoadPreAggregationResult,
2122
PreAggregations,
2223
tablesToVersionEntries,
23-
version, VersionEntriesObj,
24+
version,
25+
VersionEntriesObj,
2426
VersionEntry
2527
} from './PreAggregations';
2628
import { PreAggregationLoadCache } from './PreAggregationLoadCache';
@@ -56,23 +58,23 @@ export class PreAggregationLoader {
5658
* (initialized by the /cubejs-system/v1/pre-aggregations/jobs endpoint) or
5759
* not.
5860
*/
59-
private isJob: boolean;
61+
private readonly isJob: boolean;
6062

61-
private waitForRenew: boolean;
63+
private readonly waitForRenew: boolean;
6264

63-
private forceBuild: boolean;
65+
private readonly forceBuild: boolean;
6466

65-
private orphanedTimeout: number;
67+
private readonly orphanedTimeout: number;
6668

67-
private externalDriverFactory: DriverFactory;
69+
private readonly externalDriverFactory: DriverFactory;
6870

69-
private requestId: string;
71+
private readonly requestId: string;
7072

71-
private metadata: any;
73+
private readonly metadata: any;
7274

73-
private structureVersionPersistTime: any;
75+
private readonly structureVersionPersistTime: any;
7476

75-
private externalRefresh: boolean;
77+
private readonly externalRefresh: boolean;
7678

7779
public constructor(
7880
private readonly driverFactory: DriverFactory,
@@ -242,7 +244,7 @@ export class PreAggregationLoader {
242244
versionEntries.byStructure[`${this.preAggregation.tableName}_${structureVersion}`] ||
243245
versionEntries.byTableName[this.preAggregation.tableName];
244246

245-
const newVersionEntry = {
247+
const newVersionEntry: VersionEntry = {
246248
table_name: this.preAggregation.tableName,
247249
structure_version: structureVersion,
248250
content_version: contentVersion,
@@ -355,7 +357,7 @@ export class PreAggregationLoader {
355357
});
356358
}
357359

358-
protected contentVersion(invalidationKeys) {
360+
protected contentVersion(invalidationKeys: InvalidationKeys) {
359361
const versionArray = [this.preAggregation.structureVersionLoadSql || this.preAggregation.loadSql];
360362
if (this.preAggregation.indexesSql && this.preAggregation.indexesSql.length) {
361363
versionArray.push(this.preAggregation.indexesSql);
@@ -394,7 +396,7 @@ export class PreAggregationLoader {
394396
}
395397
}
396398

397-
protected scheduleRefresh(invalidationKeys, newVersionEntry) {
399+
protected scheduleRefresh(invalidationKeys: InvalidationKeys, newVersionEntry: VersionEntry) {
398400
this.logger('Refreshing pre-aggregation content', {
399401
preAggregation: this.preAggregation,
400402
requestId: this.requestId,
@@ -411,7 +413,7 @@ export class PreAggregationLoader {
411413
});
412414
}
413415

414-
protected async executeInQueue(invalidationKeys, priority, newVersionEntry) {
416+
protected async executeInQueue(invalidationKeys: InvalidationKeys, priority: number, newVersionEntry: VersionEntry) {
415417
const queue = await this.preAggregations.getQueue(this.preAggregation.dataSource);
416418
return queue.executeInQueue(
417419
'query',

0 commit comments

Comments
 (0)