Skip to content

Commit

Permalink
enable snapshot garbage collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Son Roy Almerol committed Nov 15, 2024
1 parent 73cc74f commit d20c305
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/agent/sftp/sftp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion internal/agent/snapshots/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit d20c305

Please sign in to comment.