duplicate messages send fixes
continuous-integration/drone/push Build is failing

This commit is contained in:
yc
2026-04-21 15:53:56 +02:00
parent 4e78ce5799
commit 8b106db52f
6 changed files with 437 additions and 441 deletions
+6
View File
@@ -38,6 +38,12 @@ func HttpPostMessage(url string, msg []byte, timeout int) (response []byte, err
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
// Server already accepted the request (2xx) — body truncation on our
// side doesn't mean the message wasn't stored. Return what we have so
// the caller doesn't retry and produce a duplicate.
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
return body, nil
}
return nil, err
}
return body, nil