Skip to content

Commit

Permalink
Moving log attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
ldecheverz-split committed Nov 15, 2023
1 parent de4a57d commit 0cd1a69
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions splitio/producer/task/pipelined.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,20 @@ func (p *PipelinedSyncTask) sinker() {
defer asRecyblable.recycle()
}

common.WithAttempts(3, func() error {
err := common.WithAttempts(3, func() error {
p.logger.Debug(fmt.Sprintf("[pipelined/%s] - impressions post ready. making request", p.name))
req, err := p.worker.BuildRequest(bulk)
if err != nil {
p.logger.Error(fmt.Sprintf("[pipelined/%s] error building request: %s", p.name, err))
return err
return fmt.Errorf(fmt.Sprintf("[pipelined/%s] error building request: %s", p.name, err))
}

resp, err := p.httpClient.Do(req)
if err != nil {
p.logger.Error(fmt.Sprintf("[pipelined/%s] error posting: %s", p.name, err))
return err
return fmt.Errorf(fmt.Sprintf("[pipelined/%s] error posting: %s", p.name, err))
}

if resp.StatusCode < 200 || resp.StatusCode >= 300 {
p.logger.Error(fmt.Sprintf("[pipelined/%s] bad status code when sinking data: %d", p.name, resp.StatusCode))
return errHTTP
return fmt.Errorf(fmt.Sprintf("[pipelined/%s] bad status code when sinking data: %d", p.name, resp.StatusCode))
}

if resp.Body != nil {
Expand All @@ -280,6 +277,9 @@ func (p *PipelinedSyncTask) sinker() {
p.logger.Debug(fmt.Sprintf("[pipelined/%s] - impressions posted successfully", p.name))
return nil
})
if err != nil {
p.logger.Error(err)
}
}()
}
}
Expand Down

0 comments on commit 0cd1a69

Please sign in to comment.