bugfix: reuse error var in remoteWriteProm (#741)

* fix: reuse error var when remoteWritePost

* add debug log

* remove logs
This commit is contained in:
UlricQin 2021-07-25 18:23:47 +08:00 committed by GitHub
parent ae4f20bca1
commit c0b42cf29a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -225,20 +225,21 @@ func (pd *PromeDataSource) processWrite(payload []byte) {
for _, c := range pd.WriteTargets {
newC := c
go func(cc *HttpClient, payload []byte) {
sendOk := false
var err error
var rec bool
for i := 0; i < retry; i++ {
err := remoteWritePost(cc, payload)
err = remoteWritePost(cc, payload)
if err == nil {
sendOk = true
break
}
err, ok := err.(RecoverableError)
if !ok {
err, rec = err.(RecoverableError)
if !rec {
break
}
logger.Warningf("send prome fail: %v", err)
time.Sleep(time.Millisecond * 100)
}