Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Issue 10928041: Add a 30s timeout for all HTTP requests in Pub. (Closed)

Created:
8 years, 3 months ago by nweiz
Modified:
8 years, 3 months ago
Reviewers:
Bob Nystrom
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add a 30s timeout for all HTTP requests in Pub. Committed: https://code.google.com/p/dart/source/detail?r=12151

Patch Set 1 #

Patch Set 2 : Don't leave a dangling Timer lying around. #

Total comments: 7

Patch Set 3 : Code review changes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+66 lines, -49 lines) Patch
M utils/pub/hosted_source.dart View 2 chunks +6 lines, -6 lines 0 comments Download
M utils/pub/io.dart View 1 2 5 chunks +60 lines, -43 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
nweiz
8 years, 3 months ago (2012-09-06 22:04:55 UTC) #1
Bob Nystrom
https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart File utils/pub/io.dart (right): https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart#newcode346 utils/pub/io.dart:346: .transform((bytes) => new String.fromCharCodes(bytes)); Indent +2 https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart#newcode450 utils/pub/io.dart:450: Future ...
8 years, 3 months ago (2012-09-06 22:52:05 UTC) #2
nweiz
https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart File utils/pub/io.dart (right): https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart#newcode346 utils/pub/io.dart:346: .transform((bytes) => new String.fromCharCodes(bytes)); On 2012/09/06 22:52:05, Bob Nystrom ...
8 years, 3 months ago (2012-09-06 23:33:34 UTC) #3
Bob Nystrom
8 years, 3 months ago (2012-09-07 00:15:34 UTC) #4
One comment, but LGTM!

https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart
File utils/pub/io.dart (right):

https://chromiumcodereview.appspot.com/10928041/diff/3001/utils/pub/io.dart#n...
utils/pub/io.dart:454: completer.completeException(exception);
On 2012/09/06 23:33:34, nweiz wrote:
> On 2012/09/06 22:52:05, Bob Nystrom wrote:
> > I like the idea of timeout() being a separate orthogonal function, but the
> > problem here is that it doesn't actually do anything to try to cancel the
> > request that timed out.
> > 
> > It probably more or less works here because we explicitly exit() now, but if
> we
> > didn't, this would leave the app still running until dart:io's internal
> timeout
> > triggered. Can we do something better here?
> 
> Given that we do explicitly exit, I don't see anything wrong with letting the
> original future dangle. I could change this to take a callback that could
cancel
> and then throw, but it feels like that just adds complexity without any
> practical benefit.

OK. Can you update the doc comment to note that this doesn't cancel the async
operation when a timeout occurs?

Powered by Google App Engine
This is Rietveld 408576698