-
-
Notifications
You must be signed in to change notification settings - Fork 90
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(cli): set timeout for latest version check and avoid failing the CLI #1559
Conversation
WalkthroughWalkthroughThe recent changes focus on improving the robustness and efficiency of the CLI operations, particularly for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant NPM
User->>CLI: run generate()
CLI->>CLI: execute plugins sequentially
CLI->>CLI: check plugin versions
Note right of CLI: Sequential execution to avoid CPU timeouts
User->>CLI: run info()
CLI-->>NPM: getLatestVersion()
NPM-->>CLI: return version info or error
CLI->>User: display version info or error message
Note right of CLI: Improved error handling and better version retrieval logic
Assessment against linked issues
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 (
|
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
packages/schema/package.json
is excluded by!**/*.json
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
,!**/*.yaml
Files selected for processing (3)
- packages/schema/src/cli/actions/generate.ts (1 hunks)
- packages/schema/src/cli/actions/info.ts (2 hunks)
- packages/schema/src/cli/cli-util.ts (3 hunks)
Additional comments not posted (6)
packages/schema/src/cli/actions/info.ts (2)
4-4
: LGTM! Imports are correct.The import statements are correct and relevant for the functionality implemented.
28-36
: LGTM! Enhanced error handling.The changes improve error handling and provide better user feedback when fetching the latest version.
packages/schema/src/cli/actions/generate.ts (1)
46-51
: LGTM! Sequential execution of plugins and version checks.The changes ensure sequential execution of plugin runs and version checks to prevent CPU-bound plugin operations from causing version check timeouts.
packages/schema/src/cli/cli-util.ts (3)
22-22
: LGTM! Reasonable timeout value.The
CHECK_VERSION_TIMEOUT
constant is set to 1000 milliseconds, which seems reasonable for network operations.
271-277
: LGTM! Improved error handling in version check.The changes improve error handling and ensure that the function does not fail if the version check fails.
284-300
: LGTM! Robust version fetching with timeout.The
getLatestVersion
function fetches the latest version of Zenstack from the npm registry with a timeout and handles errors gracefully, providing better user feedback.
Fixes #1529