-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic data models with JavaScript #9007
Comments
Another question is, in asyncModule, I get the requestId of each request through COMPILE_CONTEXT.requestId. I found that in the same tenant, the requestId obtained after each request is unchanged. I think it should be different every time. |
Indeed, this is how it is implemented and this is by design. No bug here. The reason why it's happening is that JavaScript-based data models are evaluated in multiple (three) passes so that references to other cubes are resolved correctly.
I can suggest to cache the result of your API call, e.g., put it in a variable. It should help since your API will be called only once then.
It's hard to say what is exactly happening by that description. Ideally, it would be great to be sure this is impacting the results that you're getting + have clear instructions, with code, on how to reproduce this. UPDATED: I see that this is related to #9005. Let's continue the conversation in that issue. |
I don't think this is the best way to approach this. How is your |
@igorlukanin |
When you observe the version change, can you instantly retrieve the updated version of the data model and cache it? |
@igorlukanin But I hope you can take a look at the problem that schema_version is executed four times. Is it a normal architecture design of cube or a bug? |
Describe the bug
Each time the data model is compiled, asyncModule is called three times
Expected behavior
Each time the data model is compiled, asyncModule is called three times. asyncModule uses the asynchronous API to obtain the schema model, which seriously affects the API performance.
Minimally reproducible Cube Schema
In the following example, by introducing a logger to print information to the console, it is found that the string 'asyncModule getCubeSchema' is printed three times, which means that the asynchronous interface is requested three times.
Version:
[e.g. 1.1.7]
The text was updated successfully, but these errors were encountered: