Skip to content

Commit b2d86f7

Browse files
committed
Fix two potential bugs
1 parent 24d0d8e commit b2d86f7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (req *Request) GetURLs(clean bool) []string {
101101
p, err := url.Parse(u)
102102
if err != nil {
103103
slog.Warn("Failed to parse URL while cleaning, skipping.", "url", u, "error", err)
104-
slices.Delete(urls, i, i+1)
104+
urls = slices.Delete(urls, i, i+1)
105105
continue
106106
}
107107
p.User = nil

internal/progress/factorial.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ func (p *FactorialReporter) Call(ctx context.Context, pu Update) error {
115115

116116
go func() {
117117
res, err := p.client.Do(req)
118-
defer res.Body.Close()
119-
120118
if err != nil {
121119
logger.Error("Progress Dispatcher: Failed to send progress.", "error", err)
122120
span.RecordError(err)
123121
return
124122
}
123+
defer res.Body.Close()
124+
125125
if res.StatusCode != http.StatusOK {
126126
logger.Error("Progress Dispatcher: Progress was not accepted.", "status", res.Status)
127127
span.RecordError(err)

0 commit comments

Comments
 (0)