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 {
152152
153153 fn drop_excess_capacity ( & mut self ) {
154154 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+
163163 self . assert_invariants ( ) ;
164164 }
165165 }
You can’t perform that action at this time.
0 commit comments