Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/cubejs-server-core/src/core/CompilerApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ export class CompilerApi {
dispose() {
if (this.compiledScriptCacheInterval) {
clearInterval(this.compiledScriptCacheInterval);
this.compiledScriptCacheInterval = null;
}

this.compilers = undefined;
Copy link
Member

@ovr ovr Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! New trick in my collection!

I have a gut feeling that it's better to add flag and guard methods, so that the object is destroyed. this.destroyed = true. Maybe a decorator or something.

If it crashes somehow, it will be impossible to detect why it's crashing.
All our code is async, some users can change size of compiler cache, in this case, it's possible that some code can have a reference to CompilerApi object, while lru will fire despose that compilerAPi.dispose.

After 4 years on Rust language, I already have a panic passion for protecting such places.

WDYT?

this.queryFactory = undefined;
this.graphqlSchema = undefined;
}

setGraphQLSchema(schema) {
Expand Down
Loading