-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
chore: cache templates data #33439
base: release
Are you sure you want to change the base?
chore: cache templates data #33439
Conversation
WalkthroughWalkthroughThe recent changes introduce caching functionality for application templates and JSON data within the Appsmith server. A new helper class, Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant Client
participant ApplicationTemplateService
participant CacheableTemplateHelper
participant Cache
Client->>ApplicationTemplateService: getActiveTemplates()
ApplicationTemplateService->>CacheableTemplateHelper: getTemplates(releaseVersion, baseUrl)
CacheableTemplateHelper->>Cache: Check Cache for Templates
alt Cache Hit
Cache->>CacheableTemplateHelper: Return Cached Templates
else Cache Miss
CacheableTemplateHelper->>ApplicationTemplateService: Fetch Templates from Source
ApplicationTemplateService->>CacheableTemplateHelper: Return Templates
CacheableTemplateHelper->>Cache: Store Templates in Cache
end
CacheableTemplateHelper->>ApplicationTemplateService: Return Templates
ApplicationTemplateService->>Client: Return Templates
sequenceDiagram
participant Client
participant ApplicationTemplateService
participant CacheableTemplateHelper
participant Cache
Client->>ApplicationTemplateService: getApplicationJsonFromTemplate(templateId, baseUrl)
ApplicationTemplateService->>CacheableTemplateHelper: getApplicationByTemplateId(templateId, baseUrl)
CacheableTemplateHelper->>Cache: Check Cache for Application JSON
alt Cache Hit
Cache->>CacheableTemplateHelper: Return Cached Application JSON
else Cache Miss
CacheableTemplateHelper->>ApplicationTemplateService: Fetch Application JSON from Source
ApplicationTemplateService->>CacheableTemplateHelper: Return Application JSON
CacheableTemplateHelper->>Cache: Store Application JSON in Cache
end
CacheableTemplateHelper->>ApplicationTemplateService: Return Application JSON
ApplicationTemplateService->>Client: Return Application JSON
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (2)
Warning Review ran into problemsProblems (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9080612987. |
Deploy-Preview-URL: https://ce-33439.dp.appsmith.com |
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9083537520. |
Deploy-Preview-URL: https://ce-33439.dp.appsmith.com |
...erver/appsmith-server/src/main/java/com/appsmith/server/helpers/CacheableTemplateHelper.java
Outdated
Show resolved
Hide resolved
…o perf/block-drag-and-drop
...erver/appsmith-server/src/main/java/com/appsmith/server/helpers/CacheableTemplateHelper.java
Outdated
Show resolved
Hide resolved
...erver/appsmith-server/src/main/java/com/appsmith/server/helpers/CacheableTemplateHelper.java
Outdated
Show resolved
Hide resolved
...h-server/src/main/java/com/appsmith/server/services/ce/ApplicationTemplateServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...h-server/src/main/java/com/appsmith/server/services/ce/ApplicationTemplateServiceCEImpl.java
Outdated
Show resolved
Hide resolved
...h-server/src/main/java/com/appsmith/server/services/ce/ApplicationTemplateServiceCEImpl.java
Outdated
Show resolved
Hide resolved
…o perf/block-drag-and-drop
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9212140934. |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/9289836763. |
Deploy-Preview-URL: https://ce-33439.dp.appsmith.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
Outside diff range and nitpick comments (2)
app/server/appsmith-server/src/test/java/com/appsmith/server/services/ApplicationTemplateServiceUnitTest.java (2)
21-21
: The@SpringBootTest
annotation is used to enable full auto-configuration and start the Spring application context. This is appropriate for integration tests but might be too heavy for unit tests. Consider using@WebFluxTest
or@DataMongoTest
if more lightweight contexts are sufficient.
Line range hint
216-265
: The testgetApplicationJson_cacheIsEmpty_VerifyDataSavedInCache
is comprehensive and checks the caching behavior for application JSON data. The use of JSON objects to mock responses is appropriate. However, consider abstracting repetitive setup tasks (like JSON object creation) into helper methods to improve test readability and reduce code duplication.
...th-server/src/test/java/com/appsmith/server/services/ApplicationTemplateServiceUnitTest.java
Outdated
Show resolved
Hide resolved
...th-server/src/test/java/com/appsmith/server/services/ApplicationTemplateServiceUnitTest.java
Outdated
Show resolved
Hide resolved
...th-server/src/test/java/com/appsmith/server/services/ApplicationTemplateServiceUnitTest.java
Outdated
Show resolved
Hide resolved
...th-server/src/test/java/com/appsmith/server/services/ApplicationTemplateServiceUnitTest.java
Outdated
Show resolved
Hide resolved
...r/src/main/java/com/appsmith/server/imports/internal/partial/PartialImportServiceCEImpl.java
Show resolved
Hide resolved
…o perf/block-drag-and-drop
...r/src/test/java/com/appsmith/server/helpers/CacheableTemplateHelperTemplateJsonDataTest.java
Outdated
Show resolved
Hide resolved
app/server/appsmith-server/src/main/java/com/appsmith/server/dtos/CacheableApplicationJson.java
Outdated
Show resolved
Hide resolved
...erver/appsmith-server/src/main/java/com/appsmith/server/helpers/CacheableTemplateHelper.java
Outdated
Show resolved
Hide resolved
Failed server tests
|
...r/src/test/java/com/appsmith/server/helpers/CacheableTemplateHelperTemplateJsonDataTest.java
Outdated
Show resolved
Hide resolved
...r/src/test/java/com/appsmith/server/helpers/CacheableTemplateHelperTemplateMetadataTest.java
Show resolved
Hide resolved
Failed server tests
|
Description
Cache the templates data to improve the turn around time
Fixes #33440
Automation
/ok-to-test tags="@tag.Templates"
🔍 Cypress test results
Caution
🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9320598934
Commit: 86d38bd
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
Communication
Should the DevRel and Marketing teams inform users about this change?