diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-13 09:13:51 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-13 09:13:51 +0200 |
| commit | 7a79d0a8bf58b05dfbae331d00275739530b9584 (patch) | |
| tree | 156a7c91984f11cb334a589649f337e8fa7c434d /internal/server/handlers/sessioncommand.go | |
| parent | 9f6850fc202e048dcdbfa6ffb59589d4a851cd84 (diff) | |
task 682e6ae9: filter stale generation output
Diffstat (limited to 'internal/server/handlers/sessioncommand.go')
| -rw-r--r-- | internal/server/handlers/sessioncommand.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/server/handlers/sessioncommand.go b/internal/server/handlers/sessioncommand.go index 0d54963..25b8d15 100644 --- a/internal/server/handlers/sessioncommand.go +++ b/internal/server/handlers/sessioncommand.go @@ -140,6 +140,7 @@ func (s *sessionCommandState) start(handler *ServerHandler, spec session.Spec) ( s.spec = spec s.cancel = cancel s.mu.Unlock() + ctx = withSessionGeneration(ctx, 1) handler.resetSessionAggregates() if err := handler.dispatchSessionCommands(ctx, commands); err != nil { @@ -172,6 +173,7 @@ func (s *sessionCommandState) update(handler *ServerHandler, spec session.Spec, s.spec = spec s.cancel = cancel s.mu.Unlock() + ctx = withSessionGeneration(ctx, generation) if oldCancel != nil { oldCancel() @@ -220,6 +222,12 @@ func (s *sessionCommandState) keepAlive() bool { return s.active } +func (s *sessionCommandState) currentGeneration() uint64 { + s.mu.Lock() + defer s.mu.Unlock() + return s.generation +} + func (s *sessionCommandState) reset() { s.mu.Lock() defer s.mu.Unlock() |
