File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -152,14 +152,14 @@ mod state {
152
152
153
153
fn drop_excess_capacity ( & mut self ) {
154
154
self . assert_invariants ( ) ;
155
- if self . active_jobs == self . pending_jobs {
156
- // Drop all excess tokens
157
- self . tokens . truncate ( std:: cmp:: max ( self . active_jobs , 1 ) ) ;
158
- } else {
159
- // Keep some excess tokens to satisfy requests faster
160
- const MAX_EXTRA_CAPACITY : usize = 2 ;
161
- self . tokens . truncate ( std:: cmp:: max ( self . active_jobs + MAX_EXTRA_CAPACITY , 1 ) ) ;
162
- }
155
+
156
+ // Drop all tokens that can never be used anymore
157
+ self . tokens . truncate ( std:: cmp:: max ( self . pending_jobs , 1 ) ) ;
158
+
159
+ // Keep some excess tokens to satisfy requests faster
160
+ const MAX_EXTRA_CAPACITY : usize = 2 ;
161
+ self . tokens . truncate ( std:: cmp:: max ( self . active_jobs + MAX_EXTRA_CAPACITY , 1 ) ) ;
162
+
163
163
self . assert_invariants ( ) ;
164
164
}
165
165
}
You can’t perform that action at this time.
0 commit comments