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

Unified Diff: lib/src/io.dart

Issue 1235013002: Remove the timeout for downloading packages. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/src/io.dart
diff --git a/lib/src/io.dart b/lib/src/io.dart
index d24ede0203bd1b4c4aaebdd722e5bd904515ce3e..116dc11ecd01a0973a34eeebf14bc3df28dc1ddf 100644
--- a/lib/src/io.dart
+++ b/lib/src/io.dart
@@ -829,47 +829,6 @@ _doProcess(Function fn, String executable, List<String> args,
environment: environment);
}
-/// Wraps [input], an asynchronous network operation to provide a timeout.
-///
-/// If [input] completes before [milliseconds] have passed, then the return
-/// value completes in the same way. However, if [milliseconds] pass before
-/// [input] has completed, it completes with a [TimeoutException] with
-/// [description] (which should be a fragment describing the action that timed
-/// out).
-///
-/// [url] is the URL being accessed asynchronously.
-///
-/// Note that timing out will not cancel the asynchronous operation behind
-/// [input].
-Future timeout(Future input, int milliseconds, Uri url, String description) {
- // TODO(nwiez): Replace this with [Future.timeout].
- var completer = new Completer();
- var duration = new Duration(milliseconds: milliseconds);
- var timer = new Timer(duration, () {
- // Include the duration ourselves in the message instead of passing it to
- // TimeoutException since we show nicer output.
- var message = 'Timed out after ${niceDuration(duration)} while '
- '$description.';
-
- if (url.host == "pub.dartlang.org" ||
- url.host == "storage.googleapis.com") {
- message += "\nThis is likely a transient error. Please try again later.";
- }
-
- completer.completeError(new TimeoutException(message), new Chain.current());
- });
- input.then((value) {
- if (completer.isCompleted) return;
- timer.cancel();
- completer.complete(value);
- }).catchError((e, stackTrace) {
- if (completer.isCompleted) return;
- timer.cancel();
- completer.completeError(e, stackTrace);
- });
- return completer.future;
-}
-
/// Creates a temporary directory and passes its path to [fn].
///
/// Once the [Future] returned by [fn] completes, the temporary directory and
« lib/src/http.dart ('K') | « lib/src/http.dart ('k') | lib/src/source/hosted.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698