Skip to content

Remove redundant sync_done() call in SystemStarted event handler #4425

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

Open
wants to merge 1 commit into
base: dag-master
Choose a base branch
from

Conversation

sanlee42
Copy link
Member

@sanlee42 sanlee42 commented Mar 11, 2025

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Other information

Summary by CodeRabbit

  • Refactor
    • Adjusted the synchronization behavior on system startup so that the system no longer immediately indicates that synchronization is complete.
    • Maintained the existing notifications and event broadcasts to ensure smooth, consistent operation post-startup.

Copy link

coderabbitai bot commented Mar 11, 2025

Walkthrough

The change modifies the handle_event method for the SystemStarted event in the sync module. The call to mark the synchronization as complete (sync_done()) has been removed, meaning that upon system startup, the state is no longer explicitly set as done at that moment. The subsequent logic to notify a CheckSyncEvent and broadcast a SyncStatusChangeEvent remains intact, affecting only the immediate synchronization status update during the startup sequence.

Changes

File(s) Change Summary
sync/src/sync.rs Removed the call to self.sync_status.sync_done() in the handle_event method for the SystemStarted event, while keeping the notification steps unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant System as System
    participant SyncService as SyncService
    participant Notifier as Event Notifier

    System->>SyncService: Emit SystemStarted event
    Note right of SyncService: Process event without marking sync as done
    SyncService->>Notifier: Notify CheckSyncEvent
    SyncService->>Notifier: Broadcast SyncStatusChangeEvent
Loading

Poem

I'm a rabbit on the run,
Hopping through the code with fun,
System starts without a "done",
Events bloom one by one,
Sync now dances in the sun 🐇✨
Cheers to changes, let's hop on!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 053d376 and a5df43e.

📒 Files selected for processing (1)
  • sync/src/sync.rs (0 hunks)
💤 Files with no reviewable changes (1)
  • sync/src/sync.rs

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.
    • 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 generate docstrings to generate docstrings for 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.

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.

@sanlee42 sanlee42 requested a review from jackzhhuang March 11, 2025 05:41
Copy link

Benchmark for 7e19799

Click to view benchmark
Test Base PR %
accumulator_append 877.7±155.39µs 811.2±126.17µs -7.58%
block_apply/block_apply_10 392.2±17.67ms 388.6±21.95ms -0.92%
block_apply/block_apply_1000 41.4±1.73s 41.5±1.40s +0.24%
get_with_proof/db_store 44.0±1.42µs 45.9±6.35µs +4.32%
get_with_proof/mem_store 36.2±1.27µs 37.2±4.04µs +2.76%
put_and_commit/db_store/1 118.8±13.75µs 120.1±11.61µs +1.09%
put_and_commit/db_store/10 1059.3±71.56µs 1034.5±47.81µs -2.34%
put_and_commit/db_store/100 10.2±1.45ms 9.9±0.63ms -2.94%
put_and_commit/db_store/5 558.7±75.70µs 538.9±28.01µs -3.54%
put_and_commit/db_store/50 6.0±1.30ms 4.9±0.22ms -18.33%
put_and_commit/mem_store/1 70.1±7.62µs 76.7±17.71µs +9.42%
put_and_commit/mem_store/10 673.2±77.85µs 666.1±61.81µs -1.05%
put_and_commit/mem_store/100 6.5±0.44ms 6.4±0.36ms -1.54%
put_and_commit/mem_store/5 335.2±41.22µs 327.2±31.07µs -2.39%
put_and_commit/mem_store/50 3.2±0.22ms 3.2±0.14ms 0.00%
query_block/query_block_in(10)_times(100) 8.8±0.77ms 8.5±0.25ms -3.41%
query_block/query_block_in(10)_times(1000) 89.0±5.41ms 96.5±11.29ms +8.43%
query_block/query_block_in(10)_times(10000) 823.6±25.99ms 875.8±58.23ms +6.34%
query_block/query_block_in(1000)_times(100) 1218.0±29.35µs 1220.0±65.44µs +0.16%
query_block/query_block_in(1000)_times(1000) 11.8±0.26ms 12.9±1.88ms +9.32%
query_block/query_block_in(1000)_times(10000) 122.4±18.53ms 123.4±9.74ms +0.82%
storage_transaction 1271.4±486.31µs 1283.1±649.08µs +0.92%
vm/transaction_execution/1 453.6±48.28ms 419.1±12.21ms -7.61%
vm/transaction_execution/10 143.8±11.75ms 141.8±8.72ms -1.39%
vm/transaction_execution/20 129.1±8.86ms 126.3±7.64ms -2.17%
vm/transaction_execution/5 179.2±17.75ms 171.9±6.87ms -4.07%
vm/transaction_execution/50 148.7±8.26ms 143.0±3.85ms -3.83%

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.

2 participants