Skip to content
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

fix: fixed page data DB call getting called twice #36247

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

sneha122
Copy link
Contributor

@sneha122 sneha122 commented Sep 11, 2024

Description

After perf updates made in PR https://github.com/appsmithorg/appsmith/pull/36118/files, Page data DB fetch call was getting triggered twice, one for PAGES_SPAN and one for ACTIONS_SPAN. With this PR, we have replaced that a single Mono which is being cached.

More details: https://theappsmith.slack.com/archives/C024GUDM0LT/p1725960912325389

Fixes #Issue Number
or
Fixes #36243

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10808901838
Commit: d36df4c
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Wed, 11 Sep 2024 09:49:39 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Performance Improvements
    • Enhanced the page loading process by implementing a caching mechanism for retrieving branched page data, potentially reducing database calls and improving overall application performance.
    • Streamlined the retrieval logic for branched pages, ensuring consistent execution regardless of the base page ID state.

Copy link
Contributor

coderabbitai bot commented Sep 11, 2024

Walkthrough

The pull request modifies the getConsolidatedInfoForPageLoad method in the ConsolidatedAPIServiceCEImpl class. It introduces a new conditional check for basePageId, allowing an early return if it is blank. The logic for retrieving the branchedPage has been streamlined to ensure consistent execution of the retrieval process. The use of cached results is emphasized, while the overall structure of the method remains unchanged.

Changes

File Path Change Summary
app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java Modified getConsolidatedInfoForPageLoad to include an early return for blank basePageId and streamlined the retrieval of branchedPage.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant APIService
    participant Cache
    participant Database

    Client->>APIService: Request for consolidated info
    APIService->>APIService: Check if basePageId is blank
    alt basePageId is blank
        APIService-->>Client: Return early response
    else basePageId is not blank
        APIService->>Cache: Check for branchedPageMonoCached
        alt Cache hit
            Cache-->>APIService: Return cached branchedPage
        else Cache miss
            APIService->>Database: Query for branchedPage
            Database-->>APIService: Return branchedPage
            APIService->>Cache: Store branchedPage in cache
        end
        APIService->>Client: Return consolidated info
    end
Loading

Poem

In the land of code where logic reigns,
A check for basePageId now sustains.
With caching in place, we swiftly glide,
Unraveling data, with efficiency as our guide.
Early returns, like whispers of grace,
In the dance of code, we find our place! 🌟✨


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 843cfee and d36df4c.

Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/ConsolidatedAPIServiceCEImpl.java

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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Query & JS Pod Issues related to the query & JS Pod Task A simple Todo labels Sep 11, 2024
@sneha122 sneha122 added ok-to-test Required label for CI and removed Task A simple Todo Query & JS Pod Issues related to the query & JS Pod Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. labels Sep 11, 2024
@github-actions github-actions bot added Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Query & JS Pod Issues related to the query & JS Pod Task A simple Todo Bug Something isn't working labels Sep 11, 2024
@subrata71 subrata71 self-requested a review September 11, 2024 09:27
@sneha122 sneha122 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Sep 11, 2024
Copy link

Failed server tests

  • com.appsmith.server.solutions.DatasourceStructureSolutionTest#verifyUseNewStructureWhenIgnoreCacheSetTrue

@sneha122 sneha122 merged commit 1c8712a into release Sep 11, 2024
55 of 58 checks passed
@sneha122 sneha122 deleted the fix/reduce-duplicate-page-DB-calls branch September 11, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. ok-to-test Required label for CI Query & JS Pod Issues related to the query & JS Pod Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Page fetch getting called twice in consolidated view api
2 participants