mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
1
This commit is contained in:
parent
0eb36e8f2e
commit
319b0fee43
2 changed files with 11 additions and 3 deletions
|
@ -30,7 +30,7 @@ func (as *maxAggrState) pushSamples(samples []pushSample) {
|
|||
again:
|
||||
v, ok := as.m.Load(outputKey)
|
||||
if !ok {
|
||||
fmt.Printf("wang The entry is missing in the map: %d\n", time.Now().UnixMicro())
|
||||
// fmt.Printf("wang The entry is missing in the map: %d\n", time.Now().UnixMicro())
|
||||
// The entry is missing in the map. Try creating it.
|
||||
v = &maxStateValue{
|
||||
max: s.value,
|
||||
|
@ -45,7 +45,7 @@ func (as *maxAggrState) pushSamples(samples []pushSample) {
|
|||
// Use the entry created by a concurrent goroutine.
|
||||
v = vNew
|
||||
}
|
||||
fmt.Printf("wang the right way %d\n", time.Now().Unix())
|
||||
fmt.Printf("wang This is the right way %d\n", time.Now().Unix())
|
||||
sv := v.(*maxStateValue)
|
||||
sv.mu.Lock()
|
||||
deleted := sv.deleted
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package streamaggr
|
||||
|
||||
import (
|
||||
// "fmt"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -87,3 +87,11 @@ func TestPushSampleRace(t *testing.T) {
|
|||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
func TestPushSamples(t *testing.T) {
|
||||
for i := 0; i < 5; i++ {
|
||||
t.Run(fmt.Sprintf("Run%d", i+1), func(t *testing.T) {
|
||||
TestPushSampleRace(t)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue