diff options
author | Kornel <kornel@geekhood.net> | 2020-03-01 00:16:09 +0000 |
---|---|---|
committer | Kornel <kornel@geekhood.net> | 2020-03-01 00:16:09 +0000 |
commit | 43d93b46ab4151e17ffa9d8cc2a20566bd9ef955 (patch) | |
tree | cf3725beba087721fdc5b3091564aff81b45e390 /github_v3 | |
parent | 8a6b0f63f7536543640e684b99df2f7c537046cd (diff) |
Handle status 204
Diffstat (limited to 'github_v3')
-rw-r--r-- | github_v3/src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/github_v3/src/lib.rs b/github_v3/src/lib.rs index 2ab19e7..36e498a 100644 --- a/github_v3/src/lib.rs +++ b/github_v3/src/lib.rs @@ -157,14 +157,15 @@ impl ClientInner { }; self.wait_sec.store(wait_sec, SeqCst); - if status == StatusCode::ACCEPTED && retries > 0 { + let should_wait_for_content = status == StatusCode::ACCEPTED; + if should_wait_for_content && retries > 0 { tokio::time::delay_for(Duration::from_secs(retry_delay)).await; retry_delay *= 2; retries -= 1; continue; } - return if status.is_success() && status != StatusCode::ACCEPTED { + return if status.is_success() && !should_wait_for_content { Ok(res) } else { Err(error_for_response(res).await) |