Skip to content

Commit

Permalink
refactor: Close the socketstream lines channel only once.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaqx0r committed Jul 5, 2024
1 parent cf3931d commit 2681366
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions internal/tailer/logstream/socketstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ func (ss *socketStream) stream(ctx context.Context, wg *sync.WaitGroup, waker wa
glog.Info(err)
}
connWg.Wait()
if !ss.oneShot {
close(ss.lines)
}
close(ss.lines)
}()

var connOnce sync.Once
Expand Down Expand Up @@ -117,9 +115,6 @@ func (ss *socketStream) handleConn(ctx context.Context, wg *sync.WaitGroup, wake
glog.Info(err)
}
logCloses.Add(ss.address, 1)
if ss.oneShot {
close(ss.lines)
}
}()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down

0 comments on commit 2681366

Please sign in to comment.