-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve logs and preview server behavior #404
Conversation
@@ -50,39 +50,34 @@ async function previewStart( | |||
const existingProcess = processMetadata.get(app.externalId); | |||
|
|||
if (existingProcess) { | |||
conn.reply(`app:${app.externalId}`, 'preview:status', { | |||
wss.broadcast(`app:${app.externalId}`, 'preview:status', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this is sorta confusing, but the conn
object represents one specific connection and thus conn.reply
only replies to that one connected client, whereas wss.broadcast
broadcasts to all clients connected over a given topic.
One of the problems this can cause here is that, since this is being held in a closure for the duration of a long-lived process, the connection may close long before the preview server is done running (refreshing the page will cause this). After the connection is closed, all preview server output would never make its way to any client.
@@ -111,11 +105,12 @@ async function previewStart( | |||
onExit: (code) => { | |||
processMetadata.delete(app.externalId); | |||
|
|||
conn.reply(`app:${app.externalId}`, 'preview:status', { | |||
console.log('HERE???', code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I'll remove this.
@@ -56,11 +56,11 @@ function Preview() { | |||
case 'stopped': | |||
return ( | |||
<div className="flex justify-center items-center w-full h-full"> | |||
{lastStoppedError === null ? ( | |||
<span className="text-tertiary-foreground">Stopped preview server.</span> | |||
{exitCode === null || exitCode === 0 ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I improved this a bit here: e94f157
Thanks for all the touch ups! |
When playing around with the app, I saw some vite dev server behavior I wasn't sure on and then the logs (somewhat lacking) made it more confusing to me. I wasn't sure if we had tried to re-boot it, or what. I also didn't see anything about it shutting down. Then I noticed some websocket events were firing multiple times.
This PR:
Initial boot
Stopped the server which caused it to auto-restart