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: avoid multi ServerApp instance share one path handler #3887

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

bytemain
Copy link
Member

@bytemain bytemain commented Jul 29, 2024

Types

  • 🐛 Bug Fixes

Background or solution

应该是每个 ServerApp 实例创建一个 CommonChannelPathHandler 这个类。
原来是多个 ServerApp 共享一个 CommonChannelPathHandler 类了。

在 Codeblitz 上就会出现创建一次 ClientApp 时会触发后端所有的 ServerApp 的响应。

Changelog

avoid multi ServerApp instance share one path handler

Summary by CodeRabbit

  • 新特性

    • 引入 CommonChannelPathHandler 以增强通道路径处理能力。
    • 更新 ServerApp 以支持依赖注入的连接提供者。
  • 修复

    • 改进 WebSocket 服务器的连接和消息路由逻辑。
  • 文档

    • 更新导入语句和类属性声明,以反映新结构和依赖关系。
  • 重构

    • 增强了对通道处理的模块化和可维护性。

@railway-app railway-app bot temporarily deployed to core-pr-3887 July 29, 2024 06:49 Destroyed
Copy link

railway-app bot commented Jul 29, 2024

🚅 Previously deployed to Railway in the core project. Environment has been deleted.

Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Walkthrough

本次更改主要集中在增强通道处理和依赖注入机制上。通过引入 CommonChannelPathHandler,代码的结构和功能得到了显著改进,尤其是在处理 WebSocket 连接和通道路径时。这些修改提升了模块化、可维护性和测试的灵活性,使得不同组件之间的交互更加清晰和高效。

Changes

文件 更改摘要
packages/.../node/channel-handler.test.ts
packages/.../node/index.test.ts
引入 CommonChannelPathHandler 并在构造函数中使用,增强通道处理功能。
packages/.../common/server-handler.ts 更新 BaseCommonChannelHandler 的构造函数以接受 CommonChannelPathHandler,引入依赖注入机制。
packages/.../electron/channel-handler.ts 修改 ElectronChannelHandler 的构造函数,增强与 CommonChannelPathHandler 的集成。
packages/.../node/common-channel-handler.ts 更新构造函数以使用 CommonChannelPathHandler,提升 WebSocket 连接管理能力。
packages/.../bootstrap/app.ts 引入 injectConnectionProviders,增强 ServerApp 类的依赖注入。
packages/.../connection.ts 修改服务连接创建函数以支持 CommonChannelPathHandler,改善通道路径管理。
packages/.../extension/node/extension.service.ts 通过注入 CommonChannelPathHandler 改善服务内部状态管理。

Sequence Diagram(s)

sequenceDiagram
    participant A as Client
    participant B as Server
    participant C as CommonChannelPathHandler

    A->>B: 发送请求
    B->>C: 处理通道路径
    C-->>B: 返回通道路径
    B-->>A: 返回响应
Loading

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

@opensumi opensumi bot added the 🐞 bug Something isn't working label Jul 29, 2024
Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 54.85%. Comparing base (0173c38) to head (61e4681).
Report is 1 commits behind head on main.

Files Patch % Lines
...ages/connection/src/node/common-channel-handler.ts 80.00% 1 Missing ⚠️
packages/extension/src/node/extension.service.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3887   +/-   ##
=======================================
  Coverage   54.84%   54.85%           
=======================================
  Files        1558     1558           
  Lines       95097    95110   +13     
  Branches    19487    19489    +2     
=======================================
+ Hits        52156    52168   +12     
- Misses      35669    35670    +1     
  Partials     7272     7272           
Flag Coverage Δ
jsdom 50.29% <30.00%> (-0.01%) ⬇️
node 15.53% <93.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Ricbet Ricbet merged commit 3e7caaf into main Jul 29, 2024
13 checks passed
@Ricbet Ricbet deleted the fix/multiple-node-instance branch July 29, 2024 08:30
@coderabbitai coderabbitai bot mentioned this pull request Sep 24, 2024
1 task
@coderabbitai coderabbitai bot mentioned this pull request Jan 8, 2025
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants