From 30adf6469db1a2f7eab76225ee1c39e423a634c6 Mon Sep 17 00:00:00 2001 From: Mikhail Astashkevich Date: Fri, 28 Feb 2025 10:29:30 +0100 Subject: [PATCH 1/2] feat(server-core): add fastReloadEnabled option to CompilerApi --- packages/cubejs-backend-shared/src/env.ts | 3 +++ packages/cubejs-server-core/src/core/CompilerApi.js | 2 +- packages/cubejs-server-core/src/core/server.ts | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cubejs-backend-shared/src/env.ts b/packages/cubejs-backend-shared/src/env.ts index 85480accd48bc..192c9da7b9abe 100644 --- a/packages/cubejs-backend-shared/src/env.ts +++ b/packages/cubejs-backend-shared/src/env.ts @@ -1785,6 +1785,9 @@ const variables: Record any> = { return undefined; }, + fastReloadEnabled: () => get('CUBEJS_FAST_RELOAD_ENABLED') + .default('false') + .asBoolStrict(), }; type Vars = typeof variables; diff --git a/packages/cubejs-server-core/src/core/CompilerApi.js b/packages/cubejs-server-core/src/core/CompilerApi.js index 11d7d51a0fd89..bc764186a98d6 100644 --- a/packages/cubejs-server-core/src/core/CompilerApi.js +++ b/packages/cubejs-server-core/src/core/CompilerApi.js @@ -53,7 +53,7 @@ export class CompilerApi { compilerVersion = JSON.stringify(compilerVersion); } - if (this.options.devServer) { + if (this.options.devServer || this.options.fastReloadEnabled) { const files = await this.repository.dataSchemaFiles(); compilerVersion += `_${crypto.createHash('md5').update(JSON.stringify(files)).digest('hex')}`; } diff --git a/packages/cubejs-server-core/src/core/server.ts b/packages/cubejs-server-core/src/core/server.ts index bbc1883bcbb82..7c2033d54140c 100644 --- a/packages/cubejs-server-core/src/core/server.ts +++ b/packages/cubejs-server-core/src/core/server.ts @@ -689,6 +689,7 @@ export class CubejsServerCore { sqlCache: this.options.sqlCache, standalone: this.standalone, allowNodeRequire: options.allowNodeRequire, + fastReloadEnabled: getEnv('fastReloadEnabled'), }, ); } From 14885c81c6b647926a8d413e86143504c90274a9 Mon Sep 17 00:00:00 2001 From: Michael Astashkevich Date: Fri, 28 Feb 2025 11:31:39 +0100 Subject: [PATCH 2/2] Update packages/cubejs-server-core/src/core/server.ts Co-authored-by: Konstantin Burkalev --- packages/cubejs-server-core/src/core/server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cubejs-server-core/src/core/server.ts b/packages/cubejs-server-core/src/core/server.ts index 7c2033d54140c..57b6e0954669b 100644 --- a/packages/cubejs-server-core/src/core/server.ts +++ b/packages/cubejs-server-core/src/core/server.ts @@ -689,7 +689,7 @@ export class CubejsServerCore { sqlCache: this.options.sqlCache, standalone: this.standalone, allowNodeRequire: options.allowNodeRequire, - fastReloadEnabled: getEnv('fastReloadEnabled'), + fastReloadEnabled: options.fastReloadEnabled || getEnv('fastReloadEnabled'), }, ); }