pub icon indicating copy to clipboard operation
pub copied to clipboard

would like a re-try count on pub get, pub upgrade

Open devoncarew opened this issue 6 years ago • 4 comments

CI systems can occasionally fail based on transient network issues - we see this as flaky pub get failures on bots. It'd be nice to have a feature where pub get could retry a set number of times if there are network issues. So, something like:

pub get --retry-times=5

devoncarew avatar Feb 11 '19 21:02 devoncarew

https://github.com/dart-lang/pub/blob/980fc947db32bca6ae7d07fbb4ad0fcdba0050ec/lib/src/http.dart#L224-L232

Already have it hard-wired to 5. I guess you could ask for making that parameterized to support a different value.

kevmoo avatar Feb 11 '19 21:02 kevmoo

Ah, ok, I wasn't aware. I probably would have just passed in 5 on the CLI. It looks like we must have hit a persistent outage (of a few minutes) for our particular CI run.

devoncarew avatar Feb 11 '19 22:02 devoncarew

Hmm, the argument against an option is that:

  1. it's not needed since we already retry,
  2. setting to a large number won't do you much good :)

jonasfj avatar Feb 11 '19 23:02 jonasfj

@jonasfj should we close this?

There is a environment variable: "PUB_MAX_HTTP_RETRIES" you can set, although this is not documented anywhere.

https://github.com/dart-lang/pub/blob/a3689f03168c896dd1cb0db8a60c568b38ee16bf/lib/src/http.dart#L355

sigurdm avatar Jan 23 '24 12:01 sigurdm