forked from briancavalier/creed
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
A token that is cancelled after a timeout is simple:
new CancelToken(cancel => setTimeout(cancel, t, "timeout"))However, this keeps the setTimeout active even when the token is no longer needed and all promises that might be cancelled by it are already resolved. This could keep a process alive even when there's nothing to do any more.
Implement a TimeoutToken that does not need any resources while nobody is listening, i.e. simply stores the end time and calls setTimeout/clearTimeout as necessary.
In node, this also could be achieved by a simple unref call.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels