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 @@ -820,19 +820,25 @@ private void CleanupExpiredLeasesCore()
820820 // These are the grains which we were supposed to have removed when the silo was marked as dead,
821821 // but we kept them around until we were sure the silo was actually dead.
822822
823- var toRemove = _directory . Where ( kvp => expiredSilos . Contains ( kvp . Value . SiloAddress ! ) ) . ToList ( ) ;
823+ var removedCount = 0 ;
824824
825- foreach ( var kvp in toRemove )
825+ foreach ( var kvp in _directory )
826826 {
827- _directory . Remove ( kvp . Key ) ;
827+ if ( expiredSilos . Contains ( kvp . Value . SiloAddress ! ) )
828+ {
829+ if ( _directory . Remove ( kvp . Key ) )
830+ {
831+ removedCount ++ ;
832+ }
833+ }
828834 }
829835
830836 foreach ( var silo in expiredSilos )
831837 {
832838 _siloLeaseHolds . Remove ( silo ) ;
833839 }
834840
835- LogDebugPrunedExpiredSiloLeaseHolds ( _logger , expiredSilos . Count , toRemove . Count ) ;
841+ LogDebugPrunedExpiredSiloLeaseHolds ( _logger , expiredSilos . Count , removedCount ) ;
836842 }
837843 }
838844 }
You can’t perform that action at this time.
0 commit comments