diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-03 14:48:17 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-03 14:48:17 +0200 |
| commit | 46d4917ea0eaa587e87602200fb6843776cc62a5 (patch) | |
| tree | 5e3ca8b2cd975d077c3a0f3dca49ca6468ac4da9 /internal/server/handlers | |
| parent | 852f10bb5d87cbaf1089a532c27777ac4153fde7 (diff) | |
Add dtailhealth no-auth-key flag and adjust turbo EOF handling
Diffstat (limited to 'internal/server/handlers')
| -rw-r--r-- | internal/server/handlers/readcommand.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/internal/server/handlers/readcommand.go b/internal/server/handlers/readcommand.go index 7cd9a63..dc3196e 100644 --- a/internal/server/handlers/readcommand.go +++ b/internal/server/handlers/readcommand.go @@ -129,14 +129,23 @@ func (r *readCommand) readFiles(ctx context.Context, ltx lcontext.LContext, dlog.Server.Info(r.server.LogContext(), "All files processed", "count", len(paths)) - // In turbo mode, signal EOF after all files are processed - // This is crucial for proper shutdown in server mode + // In turbo mode, only the final active command should signal EOF and wait for + // acknowledgement. Signaling per command in high-concurrency cat/grep sessions + // causes repeated EOF timeouts and races with still-running commands. if !r.server.TurboBoostDisabled() && !r.server.HasRegularAggregate() && (r.mode == omode.CatClient || r.mode == omode.GrepClient || r.mode == omode.TailClient) { if r.server.IsTurboMode() && r.server.HasTurboEOF() { + pending, active := r.server.PendingAndActive() + shouldSignalEOF := pending == 0 && active == 1 + if !shouldSignalEOF { + dlog.Server.Trace(r.server.LogContext(), "Skipping turbo EOF signal for non-final command", + "pending", pending, "active", active) + return + } + dlog.Server.Debug(r.server.LogContext(), "Turbo mode: flushing data before EOF signal") - // Ensure all turbo data is flushed before signaling EOF + // Ensure all turbo data is flushed before signaling EOF. r.server.FlushTurboData() // Signal EOF by closing the channel, but only once. |
