Skip to content

Commit

Permalink
Call Gosched if load an unmapped record (#469)
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Cristian Drutu <[email protected]>
  • Loading branch information
bogdandrutu authored Feb 11, 2020
1 parent 69df67d commit 2584c3e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/metric/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"fmt"
"os"
"runtime"
"sort"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2584c3e

Please sign in to comment.