【问题标题】:Increase timeout value for pub get增加 pub get 的超时值
【发布时间】:2014-03-21 17:59:21
【问题描述】:

我正在尝试使用 pub get 获取 Dart 包,但不断收到超时错误。

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

由于我的连接速度非常慢,有没有办法将超时时间增加到 5 分钟而不是默认的 30 秒?

【问题讨论】:

    标签: dart dart-pub


    【解决方案1】:

    看看source code,这似乎(还)不能配置:

    // 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;
    

    在使用它的地方,有一些代码似乎允许覆盖它;但它似乎来自请求标头;我怀疑这也是你无法控制的:

    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);
    }
    

    所以,我认为你不走运:(

    这就是说;您确定这是真正的超时,而不是其他原因(例如代理问题)吗?

    【讨论】:

      猜你喜欢
      • 2023-01-18
      • 1970-01-01
      • 2014-08-04
      • 2019-04-08
      • 2015-04-28
      • 2017-09-16
      • 2010-10-31
      • 1970-01-01
      • 2021-10-19
      相关资源
      最近更新 更多