Skip to content

Conversation

soundprojects
Copy link

No description provided.

lib/registry.js Outdated
@@ -146,7 +146,7 @@ function announce (server, service) {
}
delay = delay * REANNOUNCE_FACTOR
if (delay < REANNOUNCE_MAX_MS && !service._destroyed) {
setTimeout(broadcast, delay).unref()
setTimeout(broadcast, delay).unref && setTimeout(broadcast, delay).unref();

Choose a reason for hiding this comment

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

This will call the function broadcast twice in Node.

@hackergrrl
Copy link

Nice! Today I learned about unref().

  1. Could you run your PR through standard and fix up the linter warnings?
  2. What do you think about adding a comment noting that your code change is present because Electron's renderer doesn't support unref()?

@hackergrrl
Copy link

Addresses #32

@soundprojects
Copy link
Author

Will do!

@dsamarin
Copy link

@Audiow @noffle It would still be a good thing to clear up resources with unref() even in the renderer process. A better solution would be to access the Node.js timers explicitly with require('timers') as is done in pull request #39

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.

3 participants