question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m using Cockatiel to renew cryptographic keys from service A, in the background of service B. Service B also runs a server.

The retry and timeout policies (and, presumably, the circuit breaker, but I can’t immediately see how this works) create timer objects. These keep the Node.js process alive.

Since I’m renewing keys in the background I’d rather the timers be unreferenced. This way, my process can shut down gracefully when the server is closed.

Currently if a renewal is stuck in a retry delay (or presumably a circuit breaker delay) my process won’t shut down.

We could address this by adding an unref option in the policy creation arguments. It should default to false, which would be the current behavior, but if set to true it would ensure all timers are unreferenced.

Let me know if this is something you’d like and I can submit a PR.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
novemberborncommented, Feb 7, 2020

I’ll try and get some PRs done on Monday.

0reactions
connor4312commented, Feb 7, 2020

Okay. Let me know there’s actions to take on this issue, feel free to close it otherwise 🙂

Yea still figuring out how to compose all this stuff.

I should get some diagrams in the docs to help with that. I’ve been sort of directing people to the Polly wiki for more in-depth info, but that’s an extra hop that not everyone will make/notice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timers | Node.js v19.3.0 Documentation
unref () multiple times will have no effect. Class: Timeout #. This object is created internally and is returned from setTimeout() and setInterval ......
Read more >
Unblocking Node With Unref() - HTTP Toolkit
Timer functions like setInterval and setTimeout in Node.js return a Timeout object, representing the ongoing timer. These can be passed to clearInterval or ......
Read more >
Calling Timeout.unref() With setTimeout() Does Not Appear To ...
Once we .unref() the timer, Node.js no longer needs to hold the process open (waiting for the timer to execute), and it quietly...
Read more >
Timers - node - Read the Docs
Stops an interval from triggering. unref(). The opaque value returned by setTimeout and setInterval also has the method timer.unref() which will allow ...
Read more >
Ability to unref timers ( setTimeout , setInterval ) #880 - GitHub
Setting an interval that wont block the exiting of Bun is impossible, but is possible on Node and Deno. There is currently no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found