File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -182,10 +182,10 @@ impl RateLimiter {
182
182
task : impl Future < Output = T > ,
183
183
requires_back_off : impl Fn ( & T ) -> bool ,
184
184
) -> Result < T , RateLimiterError > {
185
- let times_rate_limited = match self
185
+ let times_rate_limited = self
186
186
. strategy ( )
187
- . times_rate_limited ( Instant :: now ( ) , & self . name )
188
- {
187
+ . times_rate_limited ( Instant :: now ( ) , & self . name ) ;
188
+ let times_rate_limited = match times_rate_limited {
189
189
None => {
190
190
tracing:: warn!( ?self . name, "dropping task because API is currently rate limited" ) ;
191
191
return Err ( RateLimiterError :: RateLimited ) ;
@@ -196,10 +196,10 @@ impl RateLimiter {
196
196
let result = task. await ;
197
197
198
198
if requires_back_off ( & result) {
199
- if let Some ( new_back_off) = self
199
+ let new_back_off = self
200
200
. strategy ( )
201
- . response_rate_limited ( times_rate_limited, & self . name )
202
- {
201
+ . response_rate_limited ( times_rate_limited, & self . name ) ;
202
+ if let Some ( new_back_off ) = new_back_off {
203
203
tracing:: warn!( ?self . name, ?new_back_off, "extended rate limiting" ) ;
204
204
}
205
205
} else {
You can’t perform that action at this time.
0 commit comments