Skip to content

Commit 1b2698d

Browse files
committed
lint
1 parent 25ddb91 commit 1b2698d

File tree

4 files changed

+17
-19
lines changed

4 files changed

+17
-19
lines changed

backoff.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ const (
1010
maxBackoff = 30 * time.Second
1111
)
1212

13-
// backoff handles exponential backoff with jitter
13+
// backoff handles exponential backoff with jitter.
1414
type backoff struct {
1515
current time.Duration
1616
}
1717

18-
// newBackoff creates a new backoff instance
18+
// newBackoff creates a new backoff instance.
1919
func newBackoff() *backoff {
2020
return &backoff{
2121
current: initialBackoff,
2222
}
2323
}
2424

25-
// next returns the next backoff duration and updates the current backoff
25+
// next returns the next backoff duration and updates the current backoff.
2626
func (b *backoff) next() time.Duration {
2727
// Add jitter between 0-1s
2828
backoff := b.current + time.Duration(time.Now().UnixNano()%1e9)
@@ -35,12 +35,12 @@ func (b *backoff) next() time.Duration {
3535
return backoff
3636
}
3737

38-
// reset resets the backoff to initial value
38+
// reset resets the backoff to initial value.
3939
func (b *backoff) reset() {
4040
b.current = initialBackoff
4141
}
4242

43-
// wait waits for the current backoff time, or until ctx is done
43+
// wait waits for the current backoff time, or until ctx is done.
4444
func (b *backoff) wait(ctx context.Context) {
4545
select {
4646
case <-ctx.Done():

client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ func NewClient(apiKey string, options ...Option) *Client {
113113
// Poll until we get the environment once
114114
go c.pollThenStartRealtime(c.ctxLocalEval)
115115
}
116-
117116
}
118117
// Initialise analytics processor
119118
if c.config.enableAnalytics {

client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ func TestWithPollingWorksWithRealtime(t *testing.T) {
10131013
assert.Contains(t, logStr, "worker=realtime")
10141014
}
10151015

1016-
// writerFunc implements io.Writer
1016+
// writerFunc implements io.Writer.
10171017
type writerFunc func(p []byte) (n int, err error)
10181018

10191019
func (f writerFunc) Write(p []byte) (n int, err error) {

realtime.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@ import (
1414
"github.com/Flagsmith/flagsmith-go-client/v4/flagengine/environments"
1515
)
1616

17-
// realtime handles the SSE connection and reconnection logic
17+
// realtime handles the SSE connection and reconnection logic.
1818
type realtime struct {
19-
client *Client
20-
ctx context.Context
21-
log *slog.Logger
22-
streamURL string
23-
envUpdatedAt time.Time
24-
backoff *backoff
25-
reconnectChan chan struct{}
19+
client *Client
20+
ctx context.Context
21+
log *slog.Logger
22+
streamURL string
23+
envUpdatedAt time.Time
24+
backoff *backoff
2625
}
2726

28-
// newRealtime creates a new realtime instance
27+
// newRealtime creates a new realtime instance.
2928
func newRealtime(client *Client, ctx context.Context, streamURL string, envUpdatedAt time.Time) *realtime {
3029
return &realtime{
3130
client: client,
@@ -40,7 +39,7 @@ func newRealtime(client *Client, ctx context.Context, streamURL string, envUpdat
4039
}
4140
}
4241

43-
// start begins the realtime connection process
42+
// start begins the realtime connection process.
4443
func (r *realtime) start() {
4544
r.log.Debug("connecting to realtime")
4645
defer func() {
@@ -59,7 +58,7 @@ func (r *realtime) start() {
5958
}
6059
}
6160

62-
// connect establishes and maintains the SSE connection
61+
// connect establishes and maintains the SSE connection.
6362
func (r *realtime) connect() error {
6463
resp, err := http.Get(r.streamURL)
6564
if err != nil {
@@ -96,7 +95,7 @@ func (r *realtime) connect() error {
9695
return nil
9796
}
9897

99-
// handleEvent processes a single SSE event
98+
// handleEvent processes a single SSE event.
10099
func (r *realtime) handleEvent(line string) error {
101100
parsedTime, err := parseUpdatedAtFromSSE(line)
102101
if err != nil {

0 commit comments

Comments
 (0)