0

I am trying to fetch Dart packages using pub get, but keep getting timeout errors.

TimeoutException after 0:00:30.000000: Timed out while fetching URL "https://pub.dartlang.org/packages/analyzer/versions/0.13.0-dev.9.tar.gz".
../../../../../Volumes/data/b/build/slave/dart-editor-mac-stable/build/dart/sdk/lib/_internal/pub/lib/src/io.dart 672  timeout.<fn>
dart:isolate                                                                                                           _RawReceivePortImpl._handleMessage
This is an unexpected error. Please run

Since I am on a very slow connection, is there a way to increase the timeout to, say, 5 minutes rather than the default 30 seconds?

Hanxue
  • 12,243
  • 18
  • 88
  • 130

1 Answers1

3

Looking at the source code, this doesn't appear to (yet) be configurable:

// TODO(nweiz): make this configurable
/// The amount of time in milliseconds to allow HTTP requests before assuming
/// they've failed.
final HTTP_TIMEOUT = 30 * 1000;

Where this is used, there is some code that seems to allow overriding it; but it seems to come from a request header; which I suspect is also out of your control:

var timeoutLength = HTTP_TIMEOUT;
var timeoutString = request.headers.remove('Pub-Request-Timeout');
if (timeoutString == 'None') {
  timeoutLength = null;
} else if (timeoutString != null) {
  timeoutLength = int.parse(timeoutString);
}

So, I think you're out of luck :(

That said; are you sure it's a genuine timeout, and not something else (like a proxy issue)?

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275