Skip to content

Commit 3903e71

Browse files
authored
PLAT-12684 make finished span queue thread safe (#132)
* fix * changelog
1 parent 9ec55ac commit 3903e71

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

BugsnagPerformance/Assets/BugsnagPerformance/Scripts/Internal/Tracer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ private void DeliverBatch()
186186
new Thread(() =>
187187
{
188188
List<Span> batch = new List<Span>();
189-
foreach (var finishedSpan in _finishedSpanQueue)
189+
lock (_queueLock)
190190
{
191-
batch.Add(finishedSpan);
191+
batch.AddRange(_finishedSpanQueue);
192+
_finishedSpanQueue.Clear();
192193
}
193-
_finishedSpanQueue.Clear();
194194
if (batch.Count == 0)
195195
{
196196
return;

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## TBD
4+
5+
### Bug Fixes
6+
7+
- Fix an issue where the access to the finished span queue in the tracer was not thread safe. [#132](https://github.com/bugsnag/bugsnag-unity-performance/pull/132)
8+
39
## v1.5.0 (2024-09-03)
410

511
### Additions

0 commit comments

Comments
 (0)