Skip to content

Commit 654a593

Browse files
authored
Remove defer unlock when goroutine change (#228)
1 parent d331795 commit 654a593

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

plugins/core/context.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ func (t *TracingContext) TakeSnapShot() interface{} {
5757

5858
func (t *TracingContext) ActiveSpan() TracingSpan {
5959
t.activeSpanLock.RLock()
60-
defer t.activeSpanLock.RUnlock()
61-
if t.activeSpan == nil || reflect.ValueOf(t.activeSpan).IsZero() {
60+
data := t.activeSpan
61+
t.activeSpanLock.RUnlock()
62+
if data == nil || reflect.ValueOf(data).IsZero() {
6263
return nil
6364
}
64-
return t.activeSpan
65+
return data
6566
}
6667

6768
func (t *TracingContext) SaveActiveSpan(s TracingSpan) {

0 commit comments

Comments
 (0)