File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/Orleans.Runtime/GrainDirectory Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -821,19 +821,25 @@ private void CleanupExpiredLeasesCore()
821821 // These are the grains which we were supposed to have removed when the silo was marked as dead,
822822 // but we kept them around until we were sure the silo was actually dead.
823823
824- var toRemove = _directory . Where ( kvp => expiredSilos . Contains ( kvp . Value . SiloAddress ! ) ) . ToList ( ) ;
824+ var removedCount = 0 ;
825825
826- foreach ( var kvp in toRemove )
826+ foreach ( var kvp in _directory )
827827 {
828- _directory . Remove ( kvp . Key ) ;
828+ if ( expiredSilos . Contains ( kvp . Value . SiloAddress ! ) )
829+ {
830+ if ( _directory . Remove ( kvp . Key ) )
831+ {
832+ removedCount ++ ;
833+ }
834+ }
829835 }
830836
831837 foreach ( var silo in expiredSilos )
832838 {
833839 _siloLeaseHolds . Remove ( silo ) ;
834840 }
835841
836- LogDebugPrunedExpiredSiloLeaseHolds ( _logger , expiredSilos . Count , toRemove . Count ) ;
842+ LogDebugPrunedExpiredSiloLeaseHolds ( _logger , expiredSilos . Count , removedCount ) ;
837843 }
838844 }
839845 }
You can’t perform that action at this time.
0 commit comments