Skip to content

Conversation

abhvsn
Copy link
Contributor

@abhvsn abhvsn commented May 30, 2025

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

Fixes #Issue Number
or
Fixes Issue URL

Warning

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

/test Sanity

🔍 Cypress test results

Tip

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


Fri, 30 May 2025 07:28:40 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a timeout for cloud service requests to improve reliability when fetching remote feature flags and organization features.
    • Optimized cloud service API communication with a dedicated connection pool and a specialized client for enhanced performance.
    • Adjusted the feature fetching task to run hourly instead of every 30 minutes, reducing system load and limiting concurrency with a dedicated scheduler.

@abhvsn abhvsn requested a review from NilanshBansal as a code owner May 30, 2025 05:33
Copy link
Contributor

coderabbitai bot commented May 30, 2025

Walkthrough

A dedicated WebClient instance for Cloud Services was introduced with a 60-second timeout applied to external API calls fetching remote feature flags and organization features. The scheduled feature-fetching task's interval was increased from 30 minutes to 1 hour, with a corresponding increase in distributed lock TTL. Existing error handling and fallback mechanisms remain unchanged.

Changes

File(s) Change Summary
app/server/appsmith-server/src/main/java/.../CacheableFeatureFlagHelperCEImpl.java Introduced dedicated Cloud Services WebClient with 60-second timeout; replaced per-call client creation; explicit constructor added
app/server/appsmith-interfaces/src/main/java/.../WebClientUtils.java Added Cloud Services-specific ConnectionProvider, 60-second timeout constant, and factory methods for dedicated WebClient creation
app/server/appsmith-server/src/main/java/.../ScheduledTaskCEImpl.java Increased fetchFeatures scheduled task interval from 30 minutes to 1 hour; extended distributed lock TTL from 20 to 45 minutes; replaced scheduler with single-thread scheduler

Suggested labels

skip-changelog, ok-to-test

Suggested reviewers

  • trishaanand

Poem

A client born for clouds so vast,
With timeouts set to hold it fast.
Tasks now wait an hour's grace,
Lock held tight in distributed space.
Connections pooled, no more delay,
Feature flags will find their way! ☁️⏳✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b5ee70 and 27d22c8.

📒 Files selected for processing (2)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/util/WebClientUtils.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ScheduledTaskCEImpl.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ScheduledTaskCEImpl.java
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/util/WebClientUtils.java
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: build
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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 the Bug Something isn't working label May 30, 2025
abhvsn added 7 commits May 30, 2025 11:20
Adjusted the scheduled task for fetching features to run every hour instead of every thirty minutes, and increased the lock TTL from 20 to 45 minutes to improve task execution reliability.
…S scheduler to 5 threads to prevent overwhelming CS - Increase connection pool from 50 to 100 for better concurrency - Add dedicated scheduler for scheduled CS tasks
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/server/appsmith-interfaces/src/main/java/com/appsmith/util/WebClientUtils.java (1)

117-125: Consider removing the alias method.

While the alias method clarifies the singleton nature, it adds unnecessary API surface. The createForCloudServices() method name already indicates its purpose clearly.

-    /**
-     * Gets the singleton WebClient instance for Cloud Services.
-     * This is an alias for createForCloudServices() but makes the singleton nature more explicit.
-     *
-     * @return Singleton WebClient configured for Cloud Services calls
-     */
-    public static WebClient getCloudServicesWebClient() {
-        return createForCloudServices();
-    }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 512e786 and 6b5ee70.

📒 Files selected for processing (2)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/util/WebClientUtils.java (3 hunks)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ScheduledTaskCEImpl.java (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ScheduledTaskCEImpl.java
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (6)
app/server/appsmith-interfaces/src/main/java/com/appsmith/util/WebClientUtils.java (6)

27-27: LGTM - Required import for timeout functionality.

The Duration import is correctly added to support the new timeout configuration.


48-49: Well-defined timeout constant.

The 60-second timeout aligns perfectly with the PR objective to prevent long-running Cloud Services API calls. The constant is appropriately public for reuse in other classes.


51-59: Robust connection provider configuration.

The dedicated connection pool with 100 max connections and proper lifecycle management (idle time, max lifetime, eviction) is well-configured for Cloud Services workload. The increased connection limit appropriately handles concurrent CS calls while preventing connection exhaustion.


61-62: Correct volatile declaration for singleton pattern.

The volatile keyword ensures proper visibility of the singleton instance across threads in the double-checked locking pattern.


94-115: Thread-safe singleton implementation.

The double-checked locking pattern is correctly implemented with synchronized blocks and volatile field. This ensures thread safety while avoiding unnecessary synchronization overhead after initialization.


127-138: Appropriate test utility with proper access control.

The reset method is correctly marked as deprecated and package-private, limiting its use to testing scenarios while discouraging production usage.

abhvsn added 5 commits May 30, 2025 12:07
…max life time from 60 to 120 seconds and evict in background time from 120 to 150 seconds for improved resource management.
…on pool settings - Replace custom bounded scheduler with single scheduler for sequential processing - Increase connection lifetime and eviction settings for better stability - Remove unused scheduler code for cleaner implementation
…ate delay constant for Cloud Services calls (100ms vs 200ms) - Keep 200ms delay for Segment API to avoid rate limits - Reduce CS delay since single scheduler already provides sequential processing
…ant - Remove delay from Cloud Services calls (fetchFeatures) since we use sequential processing - Keep delay only for Segment API calls to avoid rate limits - Cleaner code with single delay constant
… delay between fetching features for organizations to improve processing flow and manage rate limits effectively.
@abhvsn abhvsn changed the title fix: Add 60-second timeout to Cloud Services API calls to prevent long-running requests to fetch feature flags fix: Handle burst traffic for fetching feature flags during cron job May 30, 2025
@abhvsn abhvsn requested a review from trishaanand May 30, 2025 06:47
@@ -258,10 +257,10 @@ private Mono<Map<String, Long>> getUserTrackingDetails() {
UserTrackingType.MAU.name(), tuple.getT3()));
}

@Scheduled(initialDelay = 10 * 1000 /* ten seconds */, fixedRate = 30 * 60 * 1000 /* thirty minutes */)
@Scheduled(initialDelay = 10 * 1000 /* ten seconds */, fixedRate = 1 * 60 * 60 * 1000 /* one hour */)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Increased this to 1hr to reduce the freq, as anyway we have a refresh rate of 115min downstream for org level flags.

@abhvsn abhvsn added the ok-to-test Required label for CI label May 30, 2025
@abhvsn abhvsn enabled auto-merge (squash) May 30, 2025 07:05
@abhvsn abhvsn merged commit 3963649 into release May 30, 2025
54 checks passed
@abhvsn abhvsn deleted the fix/add-60s-timeout-to-cloud-services-api-calls branch May 30, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants