summaryrefslogtreecommitdiff
path: root/internal/io/fs/readfile_processor.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/io/fs/readfile_processor.go')
-rw-r--r--internal/io/fs/readfile_processor.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/io/fs/readfile_processor.go b/internal/io/fs/readfile_processor.go
index 1658541..4e636a4 100644
--- a/internal/io/fs/readfile_processor.go
+++ b/internal/io/fs/readfile_processor.go
@@ -29,10 +29,12 @@ func (f *readFile) StartWithProcessor(ctx context.Context, ltx lcontext.LContext
return err
}
+ truncateCtx, cancelTruncate := context.WithCancel(ctx)
+ defer cancelTruncate()
+
truncate := make(chan struct{})
- defer close(truncate)
- go f.periodicTruncateCheck(ctx, truncate)
+ go f.periodicTruncateCheck(truncateCtx, truncate)
// Process file with direct callbacks instead of channels
err = f.readWithProcessor(ctx, fd, reader, truncate, ltx, processor, re)
@@ -283,4 +285,4 @@ func (fp *filteringProcessor) processWithContext(rawLine *bytes.Buffer, lineNum
}
return nil
-} \ No newline at end of file
+}