Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the amount of time session trackers linger #44910

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/events/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ func (w *sliceWriter) completeStream() {
sort.Slice(w.completedParts, func(i, j int) bool {
return w.completedParts[i].Number < w.completedParts[j].Number
})

err := w.proto.cfg.Uploader.CompleteUpload(w.proto.cancelCtx, w.proto.cfg.Upload, w.completedParts)
w.proto.setCompleteResult(err)
if err != nil {
Expand Down
10 changes: 9 additions & 1 deletion lib/services/local/sessiontracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@ import (
const (
sessionPrefix = "session_tracker"
retryDelay = time.Second
terminatedTTL = 3 * time.Minute
casRetryLimit = 7
casErrorMessage = "CompareAndSwap reached retry limit"

// terminatedTTL is the TTL we set when a session tracker
// is put in a terminated state.
//
// Teleport's upload completer will attempt ot operate on any
// session that does not contain an active session tracker, so
// we choose a value here that will give sessions enough time
// to be uploaded.
terminatedTTL = 90 * time.Minute
)

type sessionTracker struct {
Expand Down
3 changes: 2 additions & 1 deletion lib/srv/sessiontracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func NewSessionTracker(ctx context.Context, trackerSpec types.SessionTrackerSpec
}, nil
}

// Close closes the session tracker and sets the tracker state to terminated
// Close closes the session tracker and sets the tracker state to terminated.
// The tracker will remain in a terminated state until it expires from the backend.
func (s *SessionTracker) Close(ctx context.Context) error {
close(s.closeC)
err := s.UpdateState(ctx, types.SessionState_SessionStateTerminated)
Expand Down
Loading