summaryrefslogtreecommitdiff
path: root/internal/server
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/server
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/server')
-rw-r--r--internal/server/handlers/readcommand.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/internal/server/handlers/readcommand.go b/internal/server/handlers/readcommand.go
index 44d5e99..8a9d0aa 100644
--- a/internal/server/handlers/readcommand.go
+++ b/internal/server/handlers/readcommand.go
@@ -63,20 +63,6 @@ func (r *readCommand) Start(ctx context.Context, ltx lcontext.LContext,
dlog.Server.Debug("Reading data from file(s)")
r.readGlob(ctx, ltx, args[1], re, retries)
-
- // In turbo mode, ensure we don't return until all pending files are processed
- // This prevents commandFinished() from being called too early
- if config.Env("DTAIL_TURBOBOOST_ENABLE") && r.server.aggregate == nil {
- for atomic.LoadInt32(&r.server.pendingFiles) > 0 {
- dlog.Server.Debug(r.server.user, "Waiting for pending files to complete", "pending", atomic.LoadInt32(&r.server.pendingFiles))
- select {
- case <-ctx.Done():
- return
- case <-time.After(100 * time.Millisecond):
- }
- }
- dlog.Server.Debug(r.server.user, "All pending files completed")
- }
}
func (r *readCommand) readGlob(ctx context.Context, ltx lcontext.LContext,
@@ -122,6 +108,7 @@ func (r *readCommand) readFiles(ctx context.Context, ltx lcontext.LContext,
// Track pending files for this batch
atomic.AddInt32(&r.server.pendingFiles, int32(len(paths)))
+ dlog.Server.Info(r.server.user, "Added pending files", "count", len(paths), "totalPending", atomic.LoadInt32(&r.server.pendingFiles))
var wg sync.WaitGroup
wg.Add(len(paths))