Skip to content

fix(cloudflare): debounce wrangler restarts and skip when env is unchanged#635

Merged
theoephraim merged 3 commits intomainfrom
copilot/debounce-file-restart-behavior
Apr 21, 2026
Merged

fix(cloudflare): debounce wrangler restarts and skip when env is unchanged#635
theoephraim merged 3 commits intomainfrom
copilot/debounce-file-restart-behavior

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

  • Cherry-picked concept from PR fix(cloudflare): ignore unchanged env watch events #631 by @shawnsw (debounce + cache equality check — already on branch)
  • Added idle threshold (5 s) on top: force a restart when the last restart was more than 5 seconds ago, even if the resolved env is unchanged
  • Co-authored-by: Shawn <shawn@docnow.au> in commit message to give credit

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

🦋 Changeset detected

Latest commit: c8e5796

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@varlock/cloudflare-integration Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

…unchanged

Builds on PR #631 by @shawnsw which added the debounce + cache equality
check. Adds a 5-second idle threshold: if no restart has happened in the
last 5 seconds, a save event will trigger a restart even when the resolved
env graph is identical. This handles the case where a user saves a file
again after a long idle period and expects the dev server to reload.

Co-authored-by: Shawn <shawn@docnow.au>"

Agent-Logs-Url: https://github.com/dmno-dev/varlock/sessions/785c3bab-96c9-480b-bcab-ec417ac2c52e

Co-authored-by: theoephraim <1158956+theoephraim@users.noreply.github.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 21, 2026

Open in StackBlitz

varlock

npm i https://pkg.pr.new/varlock@635

@varlock/astro-integration

npm i https://pkg.pr.new/@varlock/astro-integration@635

@varlock/cloudflare-integration

npm i https://pkg.pr.new/@varlock/cloudflare-integration@635

@varlock/expo-integration

npm i https://pkg.pr.new/@varlock/expo-integration@635

@varlock/nextjs-integration

npm i https://pkg.pr.new/@varlock/nextjs-integration@635

@varlock/vite-integration

npm i https://pkg.pr.new/@varlock/vite-integration@635

@varlock/1password-plugin

npm i https://pkg.pr.new/@varlock/1password-plugin@635

@varlock/akeyless-plugin

npm i https://pkg.pr.new/@varlock/akeyless-plugin@635

@varlock/aws-secrets-plugin

npm i https://pkg.pr.new/@varlock/aws-secrets-plugin@635

@varlock/azure-key-vault-plugin

npm i https://pkg.pr.new/@varlock/azure-key-vault-plugin@635

@varlock/bitwarden-plugin

npm i https://pkg.pr.new/@varlock/bitwarden-plugin@635

@varlock/dashlane-plugin

npm i https://pkg.pr.new/@varlock/dashlane-plugin@635

@varlock/doppler-plugin

npm i https://pkg.pr.new/@varlock/doppler-plugin@635

@varlock/google-secret-manager-plugin

npm i https://pkg.pr.new/@varlock/google-secret-manager-plugin@635

@varlock/hashicorp-vault-plugin

npm i https://pkg.pr.new/@varlock/hashicorp-vault-plugin@635

@varlock/infisical-plugin

npm i https://pkg.pr.new/@varlock/infisical-plugin@635

@varlock/keepass-plugin

npm i https://pkg.pr.new/@varlock/keepass-plugin@635

@varlock/keeper-plugin

npm i https://pkg.pr.new/@varlock/keeper-plugin@635

@varlock/pass-plugin

npm i https://pkg.pr.new/@varlock/pass-plugin@635

@varlock/passbolt-plugin

npm i https://pkg.pr.new/@varlock/passbolt-plugin@635

@varlock/proton-pass-plugin

npm i https://pkg.pr.new/@varlock/proton-pass-plugin@635

commit: c8e5796

Initialize lastRestartAt to Date.now() so the idle threshold guard
works correctly on first file change. Move restartTimeout = undefined
to only the skip/error paths so the exit handler can distinguish
restart-kills from voluntary exits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@theoephraim theoephraim marked this pull request as ready for review April 21, 2026 22:19
@theoephraim theoephraim merged commit 2515c80 into main Apr 21, 2026
19 checks passed
@shawnsw
Copy link
Copy Markdown

shawnsw commented Apr 22, 2026

@theoephraim tested locally, fixed the issue. when do you expect to release?

@theoephraim
Copy link
Copy Markdown
Member

Likely this evening! If not then tomorrow morning.

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