From a2c6b58d5b8525110a5386e93c2de4f6851b95c6 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 30 Jan 2016 14:03:03 +0100 Subject: [PATCH] fix(versionup): use latest oauth2 lib It enables using std::time::Duration natively --- src/mako/Cargo.toml.mako | 2 +- src/mako/api/lib/mbuild.mako | 4 ++-- src/mako/deps.mako | 2 +- src/rust/api/cmn.rs | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mako/Cargo.toml.mako b/src/mako/Cargo.toml.mako index af39c13c7fb..49e4243a615 100644 --- a/src/mako/Cargo.toml.mako +++ b/src/mako/Cargo.toml.mako @@ -31,7 +31,7 @@ hyper = "0.7" mime = "0.1.0" serde = ">= 0.6.0" serde_json = ">= 0.6.0" -yup-oauth2 = "0.5" +yup-oauth2 = ">= 0.5.4" % for dep in cargo.get('dependencies', list()): ${dep} % endfor diff --git a/src/mako/api/lib/mbuild.mako b/src/mako/api/lib/mbuild.mako index fdab9f71383..ea529331869 100644 --- a/src/mako/api/lib/mbuild.mako +++ b/src/mako/api/lib/mbuild.mako @@ -772,7 +772,7 @@ else { match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { - sleep(Duration::from_millis(d.num_milliseconds() as u64)); + sleep(d); continue; } ${delegate_finish}(false); @@ -785,7 +785,7 @@ else { if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep(Duration::from_millis(d.num_milliseconds() as u64)); + sleep(d); continue; } ${delegate_finish}(false); diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 19d837545ca..c4506a92738 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -184,7 +184,7 @@ help${agsuffix}: %>\ ${fake_target}: @mkdir -p ${target_dir} - @wget -nv ${info['discoveryRestUrl']} -O ${target} + @-wget -nv ${info['discoveryRestUrl']} -O ${target} % endfor update-json: ${' '.join(json_api_targets)} diff --git a/src/rust/api/cmn.rs b/src/rust/api/cmn.rs index 867ca1576f1..654a11ccf90 100644 --- a/src/rust/api/cmn.rs +++ b/src/rust/api/cmn.rs @@ -656,7 +656,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> Some(hh) if r.status == StatusCode::PermanentRedirect => hh, None|Some(_) => { if let Retry::After(d) = self.delegate.http_failure(&r, None, None) { - sleep(Duration::from_millis(d.num_milliseconds() as u64)); + sleep(d); continue; } return Err(Ok(r)) @@ -666,7 +666,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> } Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep(Duration::from_millis(d.num_milliseconds() as u64)); + sleep(d); continue; } return Err(Err(err)) @@ -727,7 +727,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> if let Retry::After(d) = self.delegate.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { - sleep(Duration::from_millis(d.num_milliseconds() as u64)); + sleep(d); continue; } } @@ -735,7 +735,7 @@ impl<'a, A> ResumableUploadHelper<'a, A> }, Err(err) => { if let Retry::After(d) = self.delegate.http_error(&err) { - sleep(Duration::from_millis(d.num_milliseconds() as u64)); + sleep(d); continue; } return Some(Err(err))