1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-04 09:43:23 +02:00

Call Gosched if load an unmapped record (#469)

Signed-off-by: Bogdan Cristian Drutu <bogdandrutu@gmail.com>
This commit is contained in:
Bogdan Drutu 2020-02-10 16:20:29 -08:00 committed by GitHub
parent 69df67d449
commit 2584c3e7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ import (
"context"
"fmt"
"os"
"runtime"
"sort"
"sync"
"sync/atomic"
@ -179,6 +180,9 @@ func (i *instrument) acquireHandle(ls *labels) *record {
// one time only usages, OR we can make this a blocking path and use
// a Mutex that protects the delete operation (delete only if the old
// record is associated with the key).
// Let collector get work done to remove the entry from the map.
runtime.Gosched()
continue
}
// The new entry was added to the map, good to go.