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

abandoned Completers should fire NotCompletedException() / TimeoutException() #3255

Closed
DartBot opened this issue May 26, 2012 · 3 comments
Closed
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented May 26, 2012

This issue was originally filed by is...@google.com


Working with embedded future-completer blocks revealed a painful point: we need to handle the exception on each level and do try-catch for each running block. If not implemented carefully, this could lead to cases where we don't complete (with value or with exception).

It would be great to specify a default timeout for a given completer (and it could complete with some kind of TimeoutException, or with NotCompletedException if it gets garbage collected.

@kasperl
Copy link

kasperl commented May 29, 2012

Added Area-Library, Triaged labels.

@lrhn
Copy link
Member

lrhn commented Aug 22, 2013

We have discussed a .timeout on Future before, but never agreed to actually do it.
That would return a new Future that would automatically complete when the time runs out, if the original future hasn't completed before.


Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Aug 22, 2013
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Feb 29, 2016
@lrhn
Copy link
Member

lrhn commented Aug 11, 2017

We have added timeout to Future.
We will not be adding anything to Completer. It's easy to do:
new Timer(duration, () { if (!completer.isCompleted) completer.completeError("timeout"); });
if necessary, but it's probably simpler to put the timeout on the event you are waiting for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants