Skip to content

Commit

Permalink
[FIX] when encoding the delete request if there was an error encoding…
Browse files Browse the repository at this point in the history
…, the operation continued, but shouldn't.
  • Loading branch information
aricart committed Mar 7, 2024
1 parent f85538f commit 059aa07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func multiRequest(nc *nats.Conn, timeout int, report *store.Report, operation st
end := start.Add(time.Second * time.Duration(timeout))
for ; end.After(now); now = time.Now() { // try with decreasing timeout until we dont get responses
if resp, err := sub.NextMsg(end.Sub(now)); err != nil {
if err != nats.ErrTimeout || responses == 0 {
if !errors.Is(err, nats.ErrTimeout) || responses == 0 {
report.AddError("failed to get response to %s: %v", operation, err)
}
} else if ok, srv, data := processResponse(report, resp); ok {
Expand Down Expand Up @@ -463,6 +463,7 @@ func sendDeleteRequest(ctx ActionCtx, nc *nats.Conn, timeout int, report *store.
pruneJwt, err := claim.Encode(okp)
if err != nil {
report.AddError("Could not encode delete request (err:%v)", err)
return
}
respPrune := multiRequest(nc, timeout, report, "prune", "$SYS.REQ.CLAIMS.DELETE", []byte(pruneJwt), func(srv string, data interface{}) {
if dataMap, ok := data.(map[string]interface{}); ok {
Expand Down

0 comments on commit 059aa07

Please sign in to comment.