Skip to content

Commit

Permalink
bugfix: proxyServer was conducting async behavior in useEffect withou…
Browse files Browse the repository at this point in the history
…t cleaning up the SIGINT didnt allow for graceful shutdown for subsequent startups of proxyServer
  • Loading branch information
JacobMGEvans committed Mar 29, 2022
1 parent c4e5dc3 commit 4b94bf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/flat-ladybugs-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

bugfix: The proxyServer was conducting async behavior in useEffect without cleaning up the SIGINT didn't allow for graceful shutdown for subsequent startups of proxyServer.

fixes #375
6 changes: 6 additions & 0 deletions packages/wrangler/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ export function usePreviewServer({
await reportError(err);
});
}
return () => {
if (proxyServer !== undefined) {
proxyServer.close();
setProxyServer(undefined);
}
};
}, [proxyServer, localProtocol]);

/**
Expand Down

0 comments on commit 4b94bf5

Please sign in to comment.