Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Prevent server restarting while restart in progress #1239

Merged
merged 2 commits into from
May 27, 2020

Conversation

dmaevac
Copy link
Contributor

@dmaevac dmaevac commented May 27, 2020

Resolves #920

The issue was caused by the server file watcher process calling handle_result in rapid succession. The source of this could be IDEs making many file saves (I only saw the issue in VSCode not vim), or just caused by people with an itchy cmd+S finger.

Initially considered debouncing the handle_result method, but a simple flag seems to be sufficient.

Flag was added inside the callback code for server changes and it prevents the server restart process if the flag is true.

src/api/dev.ts Outdated
@@ -310,11 +310,14 @@ class Watcher extends EventEmitter {
};

if (this.proc) {
if (this.restarting) return;
Copy link
Member

Choose a reason for hiding this comment

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

these spaces should be tabs for consistency with the existing code

@Conduitry Conduitry merged commit c9a62fa into sveltejs:master May 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev server fails to reload with "address already in use :::3000"
3 participants