Skip to content

Commit

Permalink
Remove context from struct.
Browse files Browse the repository at this point in the history
We pass the context to the functions so we don't need to keep it in here.
  • Loading branch information
jaqx0r committed May 26, 2024
1 parent 820798f commit 95a23a6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/tailer/logstream/pipestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
)

type pipeStream struct {
ctx context.Context
lines chan<- *logline.LogLine

pathname string // Given name for the underlying named pipe on the filesystem
Expand All @@ -30,7 +29,7 @@ type pipeStream struct {
// newPipeStream creates a new stream reader for Unix Pipes.
// `pathname` must already be verified as clean.
func newPipeStream(ctx context.Context, wg *sync.WaitGroup, waker waker.Waker, pathname string, fi os.FileInfo, lines chan<- *logline.LogLine) (LogStream, error) {
ps := &pipeStream{ctx: ctx, pathname: pathname, lastReadTime: time.Now(), lines: lines}
ps := &pipeStream{pathname: pathname, lastReadTime: time.Now(), lines: lines}
if err := ps.stream(ctx, wg, waker, fi); err != nil {
return nil, err
}
Expand Down Expand Up @@ -87,8 +86,7 @@ func (ps *pipeStream) stream(ctx context.Context, wg *sync.WaitGroup, waker wake

if n > 0 {
total += n
//nolint:contextcheck
decodeAndSend(ps.ctx, ps.lines, ps.pathname, n, b[:n], partial)
decodeAndSend(ctx, ps.lines, ps.pathname, n, b[:n], partial)
// Update the last read time if we were able to read anything.
ps.mu.Lock()
ps.lastReadTime = time.Now()
Expand Down

0 comments on commit 95a23a6

Please sign in to comment.
  NODES
Community 1
Intern 1
Note 1
os 6
text 11
Users 1
web 1