diff --git a/internal/agent/sftp/sftp.go b/internal/agent/sftp/sftp.go index c501c28..cb234bf 100644 --- a/internal/agent/sftp/sftp.go +++ b/internal/agent/sftp/sftp.go @@ -86,6 +86,8 @@ func handleConnection(ctx context.Context, errChan chan string, conn net.Conn, s go ssh.DiscardRequests(reqs) for newChannel := range chans { + snapshots.GarbageCollect() + if newChannel.ChannelType() != "session" { newChannel.Reject(ssh.UnknownChannelType, "unknown channel type") continue diff --git a/internal/agent/snapshots/windows.go b/internal/agent/snapshots/windows.go index 56adf92..8014224 100644 --- a/internal/agent/snapshots/windows.go +++ b/internal/agent/snapshots/windows.go @@ -156,7 +156,7 @@ func GarbageCollect() { if knownSnapshots, err := knownSnaps.GetAll(); err == nil { for _, snapshot := range knownSnapshots { if knownSnap, err := knownSnaps.Get(snapshot.Id); err == nil { - if time.Since(knownSnap.GetTimestamp()) >= 15*time.Minute { + if time.Since(knownSnap.GetTimestamp()) >= 30*time.Minute { knownSnap.Close() } }