Skip to content

Conversation

@productdevbook
Copy link
Member

Summary

  • Add null checks before closing websocket and listener to prevent errors
  • Use listener.close() instead of listener.server.close() for proper cleanup
  • Remove all listeners from watcher before closing to prevent memory leaks

Changes

  • Added conditional checks for websocket and listener existence before closing
  • Fixed listener close method call
  • Added removeAllListeners() call for watcher cleanup
  • Added null check for watcher in close hook

Test plan

  • Verify that the development server starts normally
  • Confirm that websocket connections work as expected
  • Test that the server closes cleanly without errors when stopping
  • Ensure no memory leaks occur during server restarts

- Add null checks before closing websocket and listener
- Use listener.close() instead of listener.server.close()
- Remove all listeners from watcher before closing
- Add null check for watcher in close hook
@vercel
Copy link

vercel bot commented Jul 24, 2025

@productdevbook is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 24, 2025

npm i https://pkg.pr.new/@nuxt/content@3478

commit: c08fbde

Comment on lines 219 to 222
if (watcher) {
watcher.removeAllListeners()
watcher.close()
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess you missed db.close()

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, thank you.

@farnabaz farnabaz merged commit 8041807 into nuxt:main Aug 5, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants