mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
app/vmagent/remotewrite: create new request on failure to send a block of data to remote storage
Previously the request body was already consumed before the retry, so this led to the following error: http: ContentLength=... with Body length 0
This commit is contained in:
parent
894dcb7c1c
commit
cb8c6908dc
1 changed files with 3 additions and 3 deletions
|
@ -182,6 +182,9 @@ func (c *client) runWorker() {
|
|||
}
|
||||
|
||||
func (c *client) sendBlock(block []byte) {
|
||||
retryDuration := time.Second
|
||||
|
||||
again:
|
||||
req, err := http.NewRequest("POST", c.remoteWriteURL, bytes.NewBuffer(block))
|
||||
if err != nil {
|
||||
logger.Panicf("BUG: unexected error from http.NewRequest(%q): %s", c.remoteWriteURL, err)
|
||||
|
@ -195,9 +198,6 @@ func (c *client) sendBlock(block []byte) {
|
|||
req.Header.Set("Authorization", c.authHeader)
|
||||
}
|
||||
|
||||
retryDuration := time.Second
|
||||
|
||||
again:
|
||||
startTime := time.Now()
|
||||
resp, err := c.hc.Do(req)
|
||||
c.requestDuration.UpdateDuration(startTime)
|
||||
|
|
Loading…
Reference in a new issue