diff options
| author | Shulhan <ms@kilabit.info> | 2023-12-17 15:08:39 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-12-17 15:11:41 +0700 |
| commit | 9eed1a6da4ed47a67a1569a9aa8a02f0f7ead907 (patch) | |
| tree | 73a81c030611a0bd340c2ca64d2e01418add9c87 | |
| parent | 876133ebfd9d1c27ae32a0d4d13799bedf845513 (diff) | |
| download | pakakeh.go-9eed1a6da4ed47a67a1569a9aa8a02f0f7ead907.tar.xz | |
http/sseclient: fix Retry value not set to millisecond
When client receive "retry:" message, the value is in millisecond, but
when we store it we only convert it to [time.Duration] which default
to nanosecond.
While at it, update comments on field [Client.Retry] and
[Client.Insecure].
| -rw-r--r-- | lib/http/sseclient/sseclient.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/http/sseclient/sseclient.go b/lib/http/sseclient/sseclient.go index 4ee7dc4d..8b0f9779 100644 --- a/lib/http/sseclient/sseclient.go +++ b/lib/http/sseclient/sseclient.go @@ -71,10 +71,10 @@ type Client struct { // before reconnecting back to server after disconnect. // Zero or negative value disable it. // - // This field is optional, default to 0, not retrying. + // This field is optional, default to 0 (not retrying). Retry time.Duration - // Insecure allow connect to HTTPS Endpoint with invalid + // Insecure allow connect to HTTPS endpoint with invalid // certificate. Insecure bool } @@ -442,7 +442,7 @@ func (cl *Client) parseEvent(raw []byte) { var retry int64 retry, err = strconv.ParseInt(string(fval), 10, 64) if err == nil { - cl.Retry = time.Duration(retry) + cl.Retry = time.Duration(retry) * time.Millisecond } default: // Ignore the field. |
