This repository was archived by the owner on Dec 14, 2018. It is now read-only.
File tree 1 file changed +12
-9
lines changed
src/Microsoft.Extensions.Caching.Memory
1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -290,16 +290,19 @@ private void TriggerOvercapacityCompaction()
290
290
return ;
291
291
}
292
292
293
- try
293
+ Task . Run ( _ =>
294
294
{
295
- // Keep compacting until remaining entries are at 90% of maximum
296
- // Stop compacting if no entries were removed, for example if all the remaining entries are pinned with NeverRemove priority
297
- while ( Compact ( 1 - ( ( 0.9 * _entryCountLimit . Value ) / _entries . Count ) ) && _entries . Count > _entryCountLimit . Value ) { }
298
- }
299
- finally
300
- {
301
- _compactionSemaphore . Release ( ) ;
302
- }
295
+ try
296
+ {
297
+ // Keep compacting until remaining entries are at 90% of maximum
298
+ // Stop compacting if no entries were removed, for example if all the remaining entries are pinned with NeverRemove priority
299
+ while ( Compact ( 1 - ( ( 0.9 * _entryCountLimit . Value ) / _entries . Count ) ) && _entries . Count > _entryCountLimit . Value ) { }
300
+ }
301
+ finally
302
+ {
303
+ _compactionSemaphore . Release ( ) ;
304
+ }
305
+ } ) ;
303
306
}
304
307
305
308
/// Remove at least the given percentage (0.10 for 10%) of the total entries (or estimated memory?), according to the following policy:
You can’t perform that action at this time.
0 commit comments