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

refactor(torii-graphql): move away from external url #2753

Merged
merged 4 commits into from
Dec 3, 2024

Conversation

Larkooo
Copy link
Collaborator

@Larkooo Larkooo commented Dec 3, 2024

Summary by CodeRabbit

  • New Features

    • Streamlined configuration by removing the external_url option from CLI arguments and server setup.
  • Bug Fixes

    • Improved error handling in the main function regarding the world_address specification.
  • Refactor

    • Simplified function signatures and overall code organization for better readability and maintainability.
    • Removed unused parameters and imports, enhancing code clarity.

Copy link

coderabbitai bot commented Dec 3, 2024

Walkthrough

Ohayo! The changes in this pull request streamline the Torii application by removing the external_url parameter from several functions and structures. This includes updates to the main.rs, args.rs, and server.rs files, where the external_url field and its associated logic have been eliminated. The modifications focus on simplifying the codebase, enhancing readability and maintainability while preserving the overall functionality of the application.

Changes

File Change Summary
bin/torii/src/main.rs Removed Url import and external_url parameter from spawn_rebuilding_graphql_server function. Adjusted error handling in main function.
crates/torii/cli/src/args.rs Removed external_url field from ToriiArgs and ToriiArgsConfig structs and updated with_config_file method.
crates/torii/graphql/src/server.rs Updated new and graphql_filter function signatures to remove external_url parameter. Simplified endpoint logic.

Possibly related PRs

Suggested reviewers

  • glihm

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6840081 and 035f6a2.

📒 Files selected for processing (1)
  • crates/torii/graphql/src/server.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/torii/graphql/src/server.rs

🪧 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.

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.

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: 0

🧹 Outside diff range and nitpick comments (2)
crates/torii/graphql/src/server.rs (1)

Line range hint 45-58: Ohayo sensei! Consider documenting the GraphQL subscription endpoint

Now that we've hardcoded the subscription endpoint to "graphql/ws", it would be helpful to document this in the function's documentation to make it clear for future developers.

Add this documentation above the playground_filter:

/// Returns a filter that serves the GraphQL playground.
/// The subscription endpoint is configured to use "graphql/ws".
bin/torii/src/main.rs (1)

Line range hint 286-292: Ohayo sensei! Consider improving the broker reconnection logic

The current implementation has two potential improvements:

  1. The hardcoded sleep duration could be configurable
  2. The error handling for broker.next() could be more robust

Consider this improvement:

-            tokio::time::sleep(Duration::from_secs(1)).await;
+            const RECONNECTION_DELAY: Duration = Duration::from_secs(1);
+            tokio::time::sleep(RECONNECTION_DELAY).await;
+            tracing::debug!("Reconnecting to broker after model update");
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 859c9d9 and 6840081.

📒 Files selected for processing (3)
  • bin/torii/src/main.rs (2 hunks)
  • crates/torii/cli/src/args.rs (0 hunks)
  • crates/torii/graphql/src/server.rs (2 hunks)
💤 Files with no reviewable changes (1)
  • crates/torii/cli/src/args.rs
🔇 Additional comments (2)
crates/torii/graphql/src/server.rs (1)

51-54: Ohayo! Fix typo in comment and verify URL patching

The comment contains a typo ("hsoted" should be "hosted"). Also, let's verify the URL patching behavior.

bin/torii/src/main.rs (1)

281-281: LGTM! The server.new() call is correctly updated

The removal of external_url parameter is consistent with the changes in the GraphQL server implementation.

crates/torii/graphql/src/server.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 56.03%. Comparing base (859c9d9) to head (035f6a2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/torii/graphql/src/server.rs 0.00% 5 Missing ⚠️
bin/torii/src/main.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2753   +/-   ##
=======================================
  Coverage   56.02%   56.03%           
=======================================
  Files         427      427           
  Lines       54589    54572   -17     
=======================================
- Hits        30586    30579    -7     
+ Misses      24003    23993   -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@steebchen steebchen requested a review from glihm December 3, 2024 11:20
Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

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

Infra is ready for this now, thanks for the cleanup @Larkooo.

@glihm glihm merged commit 56c0bf7 into dojoengine:main Dec 3, 2024
14 of 15 checks passed
augustin-v pushed a commit to augustin-v/dojo that referenced this pull request Dec 4, 2024
* refactor(torii-graphql): move away from external url

* fmt

* better patch

* comment typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants