Skip to content

refactor: extract scheduleNext() helper in the heartbeat - #29

Merged
dawsontoth merged 1 commit into
mainfrom
claude/heartbeat-schedulenext
Jul 23, 2026
Merged

refactor: extract scheduleNext() helper in the heartbeat#29
dawsontoth merged 1 commit into
mainfrom
claude/heartbeat-schedulenext

Conversation

@dawsontoth

Copy link
Copy Markdown
Contributor

Small follow-up to #26 (which merged as 1.1.5). A code-review pass on the equivalent nextjs change (HarperFast/nextjs#55) suggested tidying the heartbeat helper; applying the same here to keep the two plugins' build locks in sync.

  • The setTimeout + unref() scheduling was duplicated (initial beat + recursive reschedule) — extracted into a scheduleNext() helper.
  • beat/scheduleNext are now function declarations so their mutual reference is hoisting-safe.

No behavior change. npm test 34/34 pass, prettier --check clean.

🤖 Generated with Claude Code

Deduplicate the setTimeout + unref scheduling (initial beat and recursive
reschedule shared it) into scheduleNext(), and use function declarations for
beat/scheduleNext so their mutual reference is hoisting-safe. No behavior
change. Mirrors the same cleanup applied in @harperfast/nextjs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the heartbeat mechanism in src/buildLock.ts by extracting the scheduling logic into a reusable scheduleNext helper function and converting the beat arrow function into a standard function declaration. This removes duplication and improves code readability. There are no review comments, so I have no feedback to provide.

@dawsontoth
dawsontoth merged commit 2e4b1bc into main Jul 23, 2026
7 checks passed
@dawsontoth
dawsontoth deleted the claude/heartbeat-schedulenext branch July 23, 2026 18:28
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.1.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant