Skip to content

Commit

Permalink
fix: fix client 'retry' tag
Browse files Browse the repository at this point in the history
  • Loading branch information
ViolaPioggia committed Mar 10, 2024
1 parent 800cc5a commit 3fa4e71
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"bytes"
"context"
"encoding/base64"
"encoding/binary"
"fmt"
"io"
"strconv"
"sync/atomic"

"github.com/cloudwego/hertz/pkg/network/standard"
Expand Down Expand Up @@ -288,7 +288,10 @@ func (c *Client) processEvent(msg []byte) (event *Event, err error) {
case bytes.HasPrefix(line, headerEvent):
e.Event = string(append([]byte(nil), trimHeader(len(headerEvent), line)...))
case bytes.HasPrefix(line, headerRetry):
e.Retry = binary.BigEndian.Uint64(append([]byte(nil), trimHeader(len(headerRetry), line)...))
e.Retry, err = strconv.ParseUint(b2s(append([]byte(nil), trimHeader(len(headerRetry), line)...)), 10, 64)
if err != nil {
return nil, fmt.Errorf("process message `retry` failed, err is %s", err)
}
default:
// Ignore any garbage that doesn't match what we're looking for.
}
Expand Down

0 comments on commit 3fa4e71

Please sign in to comment.