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(torii): make poll time configurable #2327

Merged
merged 4 commits into from
Aug 21, 2024
Merged

Conversation

Larkooo
Copy link
Collaborator

@Larkooo Larkooo commented Aug 21, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a polling_interval parameter for enhanced control over polling frequency, defaulting to 500 milliseconds.
    • Updated events_chunk_size default to 1024 for better event chunk management.
    • Modified index_pending to ensure explicit setting and defaulting to true.
  • Bug Fixes

    • Renamed block_time to polling_interval for clarity, improving configuration understanding.

These changes enhance the application's configurability and performance, offering users more options for parameter settings.

Copy link

coderabbitai bot commented Aug 21, 2024

Walkthrough

The recent updates enhance the configuration capabilities of the application by modifying command-line argument handling and internal settings. Key changes include adjusting the events_chunk_size, renaming block_time to polling_interval, and refining default values. These enhancements aim to improve performance and provide users with greater control over application behavior during asynchronous operations.

Changes

Files Change Summary
bin/torii/src/main.rs Updated Args struct: changed events_chunk_size default from 1000 to 1024, modified index_pending to include action and default to true, added polling_interval with a default of 500 ms.
crates/torii/core/src/engine.rs Revised EngineConfig: renamed block_time to polling_interval with a default of 500 ms, increased events_chunk_size from 1000 to 1024, changed index_pending default from false to true.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Application
    participant Config

    User->>Application: Start application with parameters
    Application->>Config: Initialize with Args
    Config-->>Application: Return updated settings
    Application->>Config: Polling operation initiated
    Config-->>Application: Use polling_interval
    Application->>User: Application is running with new settings
Loading

Poem

🐇
In fields of code, we hop and play,
With new settings brightening the day.
From chunks of events, we leap so high,
Polling intervals help us fly!
Together we dance, our config refined,
A joyful tune for a rabbit's mind!
🌼


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

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54a891e and f3f1518.

Files selected for processing (2)
  • bin/torii/src/main.rs (3 hunks)
  • crates/torii/core/src/engine.rs (3 hunks)
Additional comments not posted (8)
bin/torii/src/main.rs (4)

111-111: Change to events_chunk_size default value is appropriate.

The default value for events_chunk_size has been updated to 1024, which is a power of two and may improve performance.


115-115: Change to index_pending behavior is sensible.

The index_pending field now explicitly sets its value, which helps avoid ambiguity in command-line arguments.


118-120: Addition of polling_interval enhances configurability.

The new polling_interval field allows users to specify the polling interval in milliseconds, providing more control over the application's behavior.


192-192: Usage of polling_interval in EngineConfig is correct.

The polling_interval is correctly utilized in the EngineConfig initialization, ensuring the new configuration option is applied.

crates/torii/core/src/engine.rs (4)

37-37: Renaming block_time to polling_interval improves clarity.

The field's purpose is clearer, and the default value of 500 milliseconds aligns with the changes in main.rs.


46-46: Default value for polling_interval is reasonable.

Setting the default to 500 milliseconds balances responsiveness with resource usage.


48-48: Change to events_chunk_size default value is appropriate.

Increasing the default to 1024, a power of two, may improve performance.


49-49: Setting index_pending default to true is sensible.

Indexing pending blocks by default is likely desirable in most scenarios.

@glihm glihm changed the title Poll time feat(torii): make poll time configurable Aug 21, 2024
@glihm glihm merged commit 4aa7454 into dojoengine:main Aug 21, 2024
13 checks passed
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.30%. Comparing base (48232e9) to head (f3f1518).
Report is 149 commits behind head on main.

Files Patch % Lines
bin/torii/src/main.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2327      +/-   ##
==========================================
- Coverage   68.50%   67.30%   -1.21%     
==========================================
  Files         331      354      +23     
  Lines       41337    46512    +5175     
==========================================
+ Hits        28319    31306    +2987     
- Misses      13018    15206    +2188     

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

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