summaryrefslogtreecommitdiff
path: root/internal/io/fs/readfile_processor_optimized.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-01 09:27:28 +0300
committerPaul Buetow <paul@buetow.org>2025-07-01 09:27:28 +0300
commitbf46295ff31724b4245ef68030f639a6e6ffbb8b (patch)
tree5184bc01bf802da8ab7c39e6ef0806da5aaee16b /internal/io/fs/readfile_processor_optimized.go
parent3c0fa29aad92ee81e6662989714fee5046f5a6b9 (diff)
fix: resolve turbo mode race condition and improve TestDCat2
- Fixed race condition in periodicTruncateCheck by using context cancellation - Added turbo mode support to TestDCat2 server configuration - Removed problematic wait for pending files in readCommand.Start - Fixed potential panic when truncate channel is closed while goroutine is running The test now properly enables turbo mode on both client and server, preventing the timeout issues that occurred when only the client had turbo mode enabled. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/io/fs/readfile_processor_optimized.go')
-rw-r--r--internal/io/fs/readfile_processor_optimized.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/io/fs/readfile_processor_optimized.go b/internal/io/fs/readfile_processor_optimized.go
index 8874753..bc7db05 100644
--- a/internal/io/fs/readfile_processor_optimized.go
+++ b/internal/io/fs/readfile_processor_optimized.go
@@ -218,10 +218,14 @@ func (f *readFile) StartWithProcessorOptimized(ctx context.Context, ltx lcontext
return err
}
+ // Create a cancelable context for the truncate check goroutine
+ truncateCtx, cancelTruncate := context.WithCancel(ctx)
+ defer cancelTruncate()
+
truncate := make(chan struct{})
defer close(truncate)
- go f.periodicTruncateCheck(ctx, truncate)
+ go f.periodicTruncateCheck(truncateCtx, truncate)
// For tail mode, we need to handle continuous reading
if f.seekEOF {