-
Notifications
You must be signed in to change notification settings - Fork 640
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
feat(async/delay): add persistent option #2527
feat(async/delay): add persistent option #2527
Conversation
|
Right. Let's wrap it with type guard condition Also let's mention that the option depends on |
Another naming candidate for this option would be Which do you think is better? |
async/delay.ts
Outdated
@@ -3,11 +3,13 @@ | |||
|
|||
export interface DelayOptions { | |||
signal?: AbortSignal; | |||
/** Defines if the timer should be non-blocking. This is `false` by default. */ |
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.
the timer should be non-blocking
sounds strange to me as timers are always async operations. I would document this like Indicates whether the process can exit while the timer still existing
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.
Another naming candidate for this option would be
persistent
(with opposite effect of boolean value) as used infs.watch
of node.js https://nodejs.org/api/fs.html#fswatchfilename-options-listenerWhich do you think is better?
Yeah, I like persistent.
fixed: default value
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.
@iuioiua Thanks for updating! Left one comment
async/delay.ts
Outdated
/** Indicates whether the process can exit before the timer ends. This is `false` by default. */ | ||
persistent?: boolean; |
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.
If we use persistent
, then the meaning (effect) is the opposite of unref
. The doc would be Indicates whether the process should continue to run as long as timer existing
and it defaults to true.
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.
My misunderstanding. Fixed now!
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.
LGTM, nice!
Let's wait a little while to see if there's any concern on this addition |
For #1730. Am I right in saying a test can't currently be done for this?