egg-cluster icon indicating copy to clipboard operation
egg-cluster copied to clipboard

feat: support reusePort on server listen

Open fengmk2 opened this issue 1 year ago β€’ 2 comments

closes https://github.com/eggjs/egg/issues/5365

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a reusePort option for server configuration, allowing multiple sockets to bind to the same port.
    • Added new routing functionality to handle specific requests in the application.
    • Implemented a new configuration file to set default application settings, including enabling reusePort.
    • Updated the contributors section in the README to use a dynamic badge for easier contributor tracking.
  • Bug Fixes

    • Enhanced test coverage for the reusePort configuration to ensure proper application startup.
  • Chores

    • Removed the pull request template, streamlining the contribution process.
    • Updated the CI pipeline to include testing against Node.js version 23.

fengmk2 avatar Oct 26 '24 12:10 fengmk2

Walkthrough

The changes in this pull request involve the removal of the pull request template, updates to the Node.js CI workflow to include version 23, and modifications to the README.md to simplify the contributors section. Additionally, new features were introduced in the server application, specifically the reusePort option in various files, enhancing the server's ability to handle multiple sockets on the same port. New test cases were added to validate these features, alongside the introduction of new configuration and application files.

Changes

File Path Change Summary
.github/PULL_REQUEST_TEMPLATE.md Removed the pull request template file, eliminating structured guidance for contributors.
.github/workflows/nodejs.yml Updated Node.js version list to include version 23 for CI testing.
README.md Replaced contributors' list with a dynamic badge from contrib.rocks.
lib/app_worker.js Added reusePort property to server options for handling multiple sockets.
lib/master.js Introduced optional reusePort parameter in Master class constructor.
lib/utils/options.js Added reusePort property to defaults object for configuration options.
test/app_worker.test.js Added test case for reusePort configuration in application startup.
test/fixtures/apps/app-listen-reusePort/app.js New file to modify application configuration for port handling.
test/fixtures/apps/app-listen-reusePort/app/router.js New routing functionality with two GET routes.
test/fixtures/apps/app-listen-reusePort/config/config.default.js New configuration file with default settings including reusePort.
test/fixtures/apps/app-listen-reusePort/package.json New package.json file for the application.
test/master.test.js Added test case for starting the master with reusePort=true.

Assessment against linked issues

Objective Addressed Explanation
Implement reusePort functionality βœ…
Ensure proper testing for reusePort βœ…
Update documentation for reusePort ❌ Documentation updates for reusePort are not present.

🐰 "In the meadow, we hop with glee,
New features sprout like flowers, you see!
With ports that share, and tests that play,
Our code is bright, come join the fray!
Hooray for changes, let’s celebrate,
In our rabbit hole, we innovate!" πŸ‡


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

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.

coderabbitai[bot] avatar Oct 26 '24 12:10 coderabbitai[bot]

Codecov Report

:x: Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 66.29%. Comparing base (789a1cd) to head (cb897b6). :warning: Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
lib/app_worker.js 83.33% 4 Missing :warning:

:exclamation: There is a different number of reports uploaded between BASE (789a1cd) and HEAD (cb897b6). Click for more details.

HEAD has 7 uploads less than BASE
Flag BASE (789a1cd) HEAD (cb897b6)
10 3
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #115       +/-   ##
===========================================
- Coverage   92.52%   66.29%   -26.24%     
===========================================
  Files          15       15               
  Lines        2021     2041       +20     
  Branches      336      190      -146     
===========================================
- Hits         1870     1353      -517     
- Misses        151      688      +537     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Oct 26 '24 13:10 codecov[bot]