Skip to content
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

timer: timer.unref clears timer #517

Open
legendecas opened this issue May 5, 2019 · 2 comments
Open

timer: timer.unref clears timer #517

legendecas opened this issue May 5, 2019 · 2 comments
Labels

Comments

@legendecas
Copy link
Contributor

  • Version: 0.11.x
  • Platform: all
  • Subsystem: timer
var timer = setInterval(() => console.log('foo'), 5 * 1000)
timer.unref()
setInterval(() => console.log('bar'), 5 * 1000)

The timer should not be cleared but unref-ed in uv-loop. Currently the timer#unref is as same as how clearInterval/clearTimeout works.

legendecas added a commit to legendecas/yodart that referenced this issue May 5, 2019
legendecas added a commit to yodaos-project/yoda.js that referenced this issue May 5, 2019
@yorkie
Copy link
Member

yorkie commented May 6, 2019

The current Node.js implementation are very different from ShadowNode(IoT.js) at the timers module, it uses a single TimerWrap to handle all timers and introduce a priority queue to improve the performance(include memory) at nodejs/node#20555.

However to fix this, I think we should call uv_unref() instead of stop(), and make sure the unref-ed timers(handles) could be closed when it's done.

@yorkie yorkie added the good first issue Issues that are suitable for first-time contributors. label May 6, 2019
@yorkie yorkie removed the good first issue Issues that are suitable for first-time contributors. label Sep 21, 2019
@yorkie
Copy link
Member

yorkie commented Sep 21, 2019

Removed the "good first issue" label just like #558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants