File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/Microsoft.IdentityModel.Tokens Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ internal class EventBasedLRUCache<TKey, TValue>
5959 private int _compactValuesState = ActionNotQueued ;
6060 private int _removeExpiredValuesState = ActionNotQueued ;
6161 private int _processCompactedValuesState = ActionNotQueued ;
62- private Task _eventQTask ;
62+ private readonly Task _eventQTask ;
6363 private int _eventQueuePollingInterval = 50 ; // in milliseconds
6464 // for testing purpose only to verify the task count
6565 private int _taskCount ;
@@ -112,6 +112,7 @@ internal EventBasedLRUCache(
112112 _compactIntervalInSeconds = compactIntervalInSeconds ;
113113 _timeForNextExpiredValuesRemoval = DateTime . UtcNow . AddSeconds ( _removeExpiredValuesIntervalInSeconds ) ;
114114 _maintainLRU = maintainLRU ;
115+ _eventQTask = Task . Run ( EventQueueTaskAction ) ;
115116 }
116117
117118 /// <summary>
@@ -136,9 +137,6 @@ internal EventBasedLRUCache(
136137
137138 private void AddActionToEventQueue ( Action action )
138139 {
139- if ( _eventQTask == null || _eventQTask . Status != TaskStatus . Running )
140- _eventQTask = Task . Run ( EventQueueTaskAction ) ;
141-
142140 _eventQueue . Enqueue ( action ) ;
143141 }
144142
You can’t perform that action at this time.
0 commit comments