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

fix: missing clear room_map in cluster cause room failed to restart #267

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

giangndm
Copy link
Contributor

@giangndm giangndm commented Apr 27, 2024

Pull Request

Description

Please provide a brief description of the changes made in this pull request.

Related Issue

This PR fix missing clear room_map in cluster cause room failed to restart

Checklist

  • I have tested the changes locally.
  • I have reviewed the code changes.
  • I have updated the documentation, if necessary.
  • I have added appropriate tests, if applicable.

Screenshots

If applicable, add screenshots to help explain the changes made.

Additional Notes

Add any additional notes or context about the pull request here.

Summary by CodeRabbit

  • New Features
    • Added logging and room removal functionality to media management.
  • Bug Fixes
    • Ensured accurate room identification during destruction with updated output parameters.
  • Tests
    • Enhanced tests to verify room removal and validate map size adjustments.

Copy link

coderabbitai bot commented Apr 27, 2024

Walkthrough

Walkthrough

The recent update enhances the MediaCluster by adding room removal functionality and logging. It also revises the Output enum in room.rs, specifically updating the Destroy variant to include a ClusterRoomHash parameter, ensuring targeted room destruction. This change is complemented by updated tests that verify the new functionality.

Changes

File Path Change Summary
.../src/cluster.rs Added logging and room removal functionality, updated tests.
.../src/cluster/room.rs Modified Output::Destroy to include ClusterRoomHash parameter.

🐇✨
In the land of code, where the clusters grow,
A rabbit hopped, tweaking as it goes.
"Destroy!" it cheers, with a hash in hand,
Ensuring rooms vanish, just as planned.
Logs and tests, all in place,
In this digital burrow, everything finds its space. 🌟
🐇✨


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7e84c13 and 4f5e314.
Files selected for processing (2)
  • packages/media_core/src/cluster.rs (3 hunks)
  • packages/media_core/src/cluster/room.rs (2 hunks)
Additional comments not posted (4)
packages/media_core/src/cluster.rs (2)

154-156: Ensure proper error handling when removing a room.

The use of expect on line 156 assumes the room will always exist in rooms_map when Destroy is processed. Consider handling the case where the room does not exist to prevent potential panics in production.


Line range hint 217-241: Review the test coverage for room removal.

The tests check the rooms_map length but do not explicitly verify the removal of the room from the task group or the handling of errors during room removal. Enhance the tests to cover these scenarios to ensure robustness.

packages/media_core/src/cluster/room.rs (2)

33-33: Addition of Destroy output to handle room removal.

The addition of the Destroy output in the Output enum is a necessary change to enable the removal of rooms based on their hash. This aligns with the PR's objectives to handle room removal correctly.


93-93: Ensure proper handling of the destroyed flag.

The logic to set the destroyed flag and generate the Destroy output is critical. Verify that this flag is correctly managed throughout the room's lifecycle to prevent multiple destruction outputs or leaks.


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

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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

codecov bot commented Apr 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 38.02%. Comparing base (7e84c13) to head (4f5e314).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #267      +/-   ##
==========================================
+ Coverage   37.93%   38.02%   +0.09%     
==========================================
  Files          39       39              
  Lines        3335     3340       +5     
==========================================
+ Hits         1265     1270       +5     
  Misses       2070     2070              

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

@giangndm giangndm marked this pull request as ready for review April 27, 2024 03:07
@giangndm giangndm merged commit ed8106a into 8xFF:master Apr 27, 2024
10 checks passed
@github-actions github-actions bot mentioned this pull request Apr 27, 2024
@giangndm giangndm deleted the fix-room-missing-clear branch June 6, 2024 00:44
giangndm added a commit to giangndm/8xFF-decentralized-media-server that referenced this pull request Nov 26, 2024
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.

1 participant