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

feat(meetings): timeout for cluster discovery request #4004

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

Coread
Copy link
Collaborator

@Coread Coread commented Nov 25, 2024

COMPLETES #< INSERT LINK TO ISSUE >

This pull request addresses

Sometimes the get clusters requests fails. Given we have a timeout of 3 seconds for reachability itself, we should also restrict the time taken to get the servers for reachability.

by making the following changes

default to 5s timer to get the clusters

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

I certified that

  • I have read and followed contributing guidelines

  • I discussed changes with code owners prior to submitting this pull request

  • I have not skipped any automated checks

  • All existing and new tests passed

  • I have updated the documentation accordingly


Make sure to have followed the contributing guidelines before submitting.

Summary by CodeRabbit

  • New Features

    • Introduced a new configuration property for meeting reachability timeout, enhancing the control over request timing.
  • Bug Fixes

    • Updated request handling to include the new timeout parameter for improved request behavior in cluster information retrieval.
  • Tests

    • Adjusted test cases to validate the new timeout parameter in the request, ensuring accuracy in request parameters and response structure.

@Coread Coread requested review from a team as code owners November 25, 2024 10:29
Copy link

coderabbitai bot commented Nov 25, 2024

Walkthrough

This pull request introduces a new configuration property, reachabilityGetClusterTimeout, set to 5000 milliseconds in the meetings configuration object within the config.ts file. Additionally, the getClusters method in the ReachabilityRequest class is modified to utilize this new timeout parameter when making requests. The related unit tests are updated to reflect this change, consolidating assertions to verify the inclusion of the timeout in request parameters.

Changes

File Path Change Summary
packages/@webex/plugin-meetings/src/config.ts Added new property reachabilityGetClusterTimeout: 5000 in the default export object.
packages/@webex/plugin-meetings/src/reachability/request.ts Modified getClusters method to include timeout parameter using this.webex.config.meetings.reachabilityGetClusterTimeout.
packages/@webex/plugin-meetings/test/unit/spec/reachability/request.js Updated test case to reflect new timeout parameter, consolidating assertions for requestParams.

Possibly related PRs

Suggested labels

validated

Suggested reviewers

  • marcin-bazyl
  • szotrabh
  • antsukanova
  • robstax

🐰 "In the meadow where meetings bloom,
A timeout's added to dispel the gloom.
With reachability now set just right,
Our clusters will gather, shining bright!
Hops of joy for this new delight!" 🌼


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>, please review it.
    • 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 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 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@Coread Coread added the validated If the pull request is validated for automation. label Nov 25, 2024
Copy link

@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: 1

🧹 Outside diff range and nitpick comments (2)
packages/@webex/plugin-meetings/src/reachability/request.ts (1)

49-49: Add safety checks for the timeout configuration.

The timeout implementation looks good and aligns with the PR objectives. However, consider adding safety measures:

  1. Ensure there's a fallback if the config is undefined
  2. Validate that the timeout value is positive

Consider updating the implementation:

- timeout: this.webex.config.meetings.reachabilityGetClusterTimeout,
+ timeout: Math.max(this.webex.config.meetings?.reachabilityGetClusterTimeout ?? 5000, 1000),

This ensures:

  • Default of 5000ms if config is missing
  • Minimum timeout of 1000ms for stability
packages/@webex/plugin-meetings/src/config.ts (1)

98-98: Add documentation for the new timeout configuration.

The new timeout configuration looks good, but consider adding a comment explaining its purpose, similar to other timeout configurations in this file.

+    // Timeout duration for retrieving server clusters during reachability checks
     reachabilityGetClusterTimeout: 5000,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e8a8fc0 and 2c11db6.

📒 Files selected for processing (3)
  • packages/@webex/plugin-meetings/src/config.ts (1 hunks)
  • packages/@webex/plugin-meetings/src/reachability/request.ts (1 hunks)
  • packages/@webex/plugin-meetings/test/unit/spec/reachability/request.js (1 hunks)
🔇 Additional comments (3)
packages/@webex/plugin-meetings/test/unit/spec/reachability/request.js (1)

65-75: LGTM! Comprehensive test assertions

The test assertions correctly verify that:

  • The timeout is properly passed to the request parameters
  • All other request parameters (method, resource, API, query string) are correctly set
packages/@webex/plugin-meetings/src/reachability/request.ts (1)

Line range hint 32-51: Verify the configuration setup across the codebase.

Let's ensure the configuration is properly initialized and documented.

✅ Verification successful

Let me check the actual configuration definition and test coverage to make a more informed decision.


Configuration is properly set up and tested

The configuration reachabilityGetClusterTimeout is:

  • Defined in config.ts with a default value of 5000ms
  • Properly used in the request implementation
  • Covered in unit tests where the timeout value is being verified
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for configuration setup and documentation

# Check for configuration definition
echo "Checking for configuration definition..."
rg -l "reachabilityGetClusterTimeout" packages/@webex/plugin-meetings/src/config.ts

# Check for configuration documentation
echo "Checking for configuration documentation..."
rg -l "reachabilityGetClusterTimeout" packages/@webex/plugin-meetings/README.md

# Check for related test coverage
echo "Checking for test coverage..."
rg -l "reachabilityGetClusterTimeout" packages/@webex/plugin-meetings/test/unit/spec/reachability/

Length of output: 636


Script:

#!/bin/bash
# Check the actual configuration definition
echo "Configuration definition in config.ts:"
rg "reachabilityGetClusterTimeout" packages/@webex/plugin-meetings/src/config.ts -A 2 -B 2

echo "\nTest coverage in request.js:"
rg "reachabilityGetClusterTimeout" packages/@webex/plugin-meetings/test/unit/spec/reachability/request.js -A 2 -B 2

Length of output: 654

packages/@webex/plugin-meetings/src/config.ts (1)

98-98: Verify the timeout usage across the codebase.

Let's verify that this timeout value is properly utilized in the ReachabilityRequest class and that there are no other hardcoded timeout values for cluster discovery.

✅ Verification successful

Based on the results, I can generate the final response since we have enough information to verify the timeout usage:

Timeout configuration is properly utilized

The timeout value reachabilityGetClusterTimeout is correctly used in the ReachabilityRequest class and there are no hardcoded timeout values for cluster discovery. Specifically:

  • The config value is used in packages/@webex/plugin-meetings/src/reachability/request.ts with proper timeout configuration
  • Tests in packages/@webex/plugin-meetings/test/unit/spec/reachability/request.js validate the timeout behavior
  • No other hardcoded timeout values were found in cluster-related code
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of the new timeout config and any hardcoded timeout values

# Check for usage of the new config
echo "Checking for reachabilityGetClusterTimeout usage:"
rg "reachabilityGetClusterTimeout" -A 3

# Look for potential hardcoded timeout values in cluster-related code
echo -e "\nChecking for hardcoded timeouts in cluster-related code:"
rg -i "cluster.*timeout|timeout.*cluster" -A 3

# Look specifically in the ReachabilityRequest class implementation
echo -e "\nChecking ReachabilityRequest implementation:"
ast-grep --pattern 'class ReachabilityRequest {
  $$$
  getClusters($_) {
    $$$
  }
  $$$
}'

Length of output: 132679

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4004.d3m3l2kee0btzx.amplifyapp.com

@webex webex deleted a comment from coderabbitai bot Nov 25, 2024
@Coread Coread merged commit 7e0ed3c into webex:next Nov 25, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated If the pull request is validated for automation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants