File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,10 @@ impl GithubClient {
51
51
const REMAINING : & str = "X-RateLimit-Remaining" ;
52
52
const RESET : & str = "X-RateLimit-Reset" ;
53
53
54
- if resp. status ( ) . is_success ( ) {
54
+ if !matches ! (
55
+ resp. status( ) ,
56
+ StatusCode :: FORBIDDEN | StatusCode :: TOO_MANY_REQUESTS
57
+ ) {
55
58
return None ;
56
59
}
57
60
@@ -60,12 +63,6 @@ impl GithubClient {
60
63
return None ;
61
64
}
62
65
63
- // Weird github api behavior. It asks us to retry but also has a remaining count above 1
64
- // Try again immediately and hope for the best...
65
- if headers[ REMAINING ] != "0" {
66
- return Some ( Duration :: from_secs ( 0 ) ) ;
67
- }
68
-
69
66
let reset_time = headers[ RESET ] . to_str ( ) . unwrap ( ) . parse :: < u64 > ( ) . unwrap ( ) ;
70
67
Some ( Duration :: from_secs ( Self :: calc_sleep ( reset_time) + 10 ) )
71
68
}
You can’t perform that action at this time.
0 commit comments