bugfix: variable scope problem (#389)

* support openID2.0

* generate UUID if it's not set

* add m3db support

* add test shell

* update transfer.yml

* remove klog

* use remote m3 repo

* remove some file

* add description for tansfer.m3db config

* add query data for ui

* bugfix: Variable scope problem
This commit is contained in:
yubo 2020-11-10 16:21:09 +08:00 committed by GitHub
parent fb1b5802ab
commit a90c746626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 8 deletions

View File

@ -191,31 +191,30 @@ func resample(data []*dataobj.RRDData, start, end, step int64) []*dataobj.RRDDat
ret := make([]*dataobj.RRDData, 0, l) ret := make([]*dataobj.RRDData, 0, l)
j := 0
ts := start ts := start
if t := data[0].Timestamp; t > start { if t := data[0].Timestamp; t > start {
ts = t - t%step ts = t - t%step
} }
j := 0
for ; ts < end; ts += step { for ; ts < end; ts += step {
get := func() *dataobj.RRDData { get := func() *dataobj.RRDData {
if j == len(data) { if j == len(data) {
return nil return nil
} }
d := data[j]
for { for {
if j == len(data) { if j == len(data) {
return &dataobj.RRDData{Timestamp: ts, Value: nanFloat} return &dataobj.RRDData{Timestamp: ts, Value: nanFloat}
} }
if d.Timestamp < ts { if d := data[j]; d.Timestamp < ts {
j++ j++
continue continue
} } else if d.Timestamp >= ts+step {
if d.Timestamp >= ts+step {
return &dataobj.RRDData{Timestamp: ts, Value: nanFloat} return &dataobj.RRDData{Timestamp: ts, Value: nanFloat}
} else {
j++
return d
} }
j++
return d
} }
} }
ret = append(ret, get()) ret = append(ret, get())