Skip to content

Commit 7e486b0

Browse files
committed
Fix System.InvalidOperationException : Collection was modified is thrown (#8826)
1 parent dd212af commit 7e486b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,10 @@ internal void EnsureTimerStarted()
11901190
internal IEnumerable<TimeSpan> GetLatencies()
11911191
{
11921192
EnsureTimerStarted();
1193-
return _workerStatusLatencyHistory;
1193+
lock (_syncLock)
1194+
{
1195+
return _workerStatusLatencyHistory.ToArray();
1196+
}
11941197
}
11951198

11961199
internal async void OnTimer(object sender, System.Timers.ElapsedEventArgs e)

0 commit comments

Comments
 (0)