Skip to content

Commit f7d663c

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

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
@@ -993,7 +993,10 @@ internal void EnsureTimerStarted()
993993
internal IEnumerable<TimeSpan> GetLatencies()
994994
{
995995
EnsureTimerStarted();
996-
return _workerStatusLatencyHistory;
996+
lock (_syncLock)
997+
{
998+
return _workerStatusLatencyHistory.ToArray();
999+
}
9971000
}
9981001

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

0 commit comments

Comments
 (0)