Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving log attempts #252

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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