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

Creating a timeout for a promise #29

Open
deblauwetom opened this issue Nov 14, 2018 · 0 comments
Open

Creating a timeout for a promise #29

deblauwetom opened this issue Nov 14, 2018 · 0 comments

Comments

@deblauwetom
Copy link

Hello,

I'm trying to use libq to create a timeout for a function that may take too long to complete. So the case is that if the function completes in time, say 5 seconds, it's ok, otherwise I want the promise to be rejected. So I created a shared promise, with one branch running the function, and another running a .delay(5s).then(...). But now I want to "cancel" the delay task if my function was completed within 5s. What would be the preferred way for this?

Best regards,
Tom,

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

No branches or pull requests

1 participant