Skip to content

Conversation

@thinkasany
Copy link
Contributor

Summary

https://github.com/web-infra-dev/rsbuild/blob/main/packages/core/src/server/socketServer.ts#L79

    if (this.heartbeatTimer !== null) {
      this.heartbeatTimer = setTimeout(
        this.checkSockets,
        CHECK_SOCKETS_INTERVAL,
      ).unref();
    }

I see that heartbeatTimer is created by setTimeout, so should clearTimeout be used when recycling and clearing? I guess this may be left by using setInterval before.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings June 21, 2025 13:06
@netlify
Copy link

netlify bot commented Jun 21, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit a6b4e08
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/6856ae6d9752c500082de451
😎 Deploy Preview https://deploy-preview-5461--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 76 (🔴 down 12 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue in the socket server where the heartbeat timer, created with setTimeout, was incorrectly cleared using clearInterval.

  • Use clearTimeout to properly clear the timer.

@thinkasany thinkasany changed the title fix: use clearTimeout instead clearInterval fix: use clearTimeout instead of clearInterval Jun 21, 2025
@thinkasany thinkasany changed the title fix: use clearTimeout instead of clearInterval fix(socketServer): use clearTimeout instead of clearInterval Jun 21, 2025
Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

@chenjiahan chenjiahan enabled auto-merge (squash) June 21, 2025 13:11
@chenjiahan chenjiahan merged commit ce5df7d into web-infra-dev:main Jun 21, 2025
13 of 14 checks passed
This was referenced Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants