Skip to content

Commit 9ea0b9c

Browse files
authored
chore(fast-reload): support fastReloadEnabled as a server option (#9294)
* chore(fast-reload): support fastReloadEnabled as a server option * rename and add to python and rust
1 parent 3f94bff commit 9ea0b9c

File tree

8 files changed

+11
-4
lines changed

8 files changed

+11
-4
lines changed

packages/cubejs-backend-native/python/cube/src/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Configuration:
7878
pre_aggregations_schema: Union[Callable[[RequestContext], str], str]
7979
orchestrator_options: Union[Dict, Callable[[RequestContext], Dict]]
8080
context_to_roles: Callable[[RequestContext], list[str]]
81+
fast_reload: bool
8182

8283
def __init__(self):
8384
self.web_sockets = None
@@ -127,6 +128,7 @@ def __init__(self):
127128
self.pre_aggregations_schema = None
128129
self.orchestrator_options = None
129130
self.context_to_roles = None
131+
self.fast_reload = None
130132

131133
def __call__(self, func):
132134
if isinstance(func, str):

packages/cubejs-backend-native/src/python/cube_config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ impl CubeConfigPy {
6464
"scheduled_refresh_contexts",
6565
"schema_version",
6666
"semantic_layer_sync",
67+
"fast_reload",
6768
]
6869
}
6970

packages/cubejs-backend-shared/src/env.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ const variables: Record<string, (...args: any) => any> = {
19631963

19641964
return undefined;
19651965
},
1966-
fastReloadEnabled: () => get('CUBEJS_FAST_RELOAD_ENABLED')
1966+
fastReload: () => get('CUBEJS_FAST_RELOAD_ENABLED')
19671967
.default('false')
19681968
.asBoolStrict(),
19691969
};

packages/cubejs-server-core/src/core/CompilerApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class CompilerApi {
5353
compilerVersion = JSON.stringify(compilerVersion);
5454
}
5555

56-
if (this.options.devServer || this.options.fastReloadEnabled) {
56+
if (this.options.devServer || this.options.fastReload) {
5757
const files = await this.repository.dataSchemaFiles();
5858
compilerVersion += `_${crypto.createHash('md5').update(JSON.stringify(files)).digest('hex')}`;
5959
}

packages/cubejs-server-core/src/core/OptsHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ export class OptsHandler {
488488
jwkUrl: getEnv('jwkUrl'),
489489
claimsNamespace: getEnv('jwtClaimsNamespace'),
490490
...opts.jwt,
491-
}
491+
},
492+
fastReload: getEnv('fastReload'),
492493
};
493494

494495
if (opts.contextToAppId && !opts.scheduledRefreshContexts) {

packages/cubejs-server-core/src/core/optionsValidate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ const schemaOptions = Joi.object().keys({
145145
// Additional system flags
146146
serverless: Joi.boolean(),
147147
allowNodeRequire: Joi.boolean(),
148+
fastReload: Joi.boolean(),
148149
});
149150

150151
export default (options: any) => {

packages/cubejs-server-core/src/core/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ export class CubejsServerCore {
539539
context,
540540
allowJsDuplicatePropsInSchema: this.options.allowJsDuplicatePropsInSchema,
541541
allowNodeRequire: this.options.allowNodeRequire,
542+
fastReload: this.options.fastReload,
542543
},
543544
);
544545

@@ -712,7 +713,7 @@ export class CubejsServerCore {
712713
sqlCache: this.options.sqlCache,
713714
standalone: this.standalone,
714715
allowNodeRequire: options.allowNodeRequire,
715-
fastReloadEnabled: options.fastReloadEnabled || getEnv('fastReloadEnabled'),
716+
fastReload: options.fastReload || getEnv('fastReload'),
716717
},
717718
);
718719
}

packages/cubejs-server-core/src/core/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ export interface CreateOptions {
227227
serverless?: boolean;
228228
allowNodeRequire?: boolean;
229229
semanticLayerSync?: (context: RequestContext) => Promise<BiToolSyncConfig[]> | BiToolSyncConfig[];
230+
fastReload?: boolean;
230231
}
231232

232233
export interface DriverDecoratedOptions extends CreateOptions {

0 commit comments

Comments
 (0)