Skip to content

Commit

Permalink
Merge pull request #10 from sonroyaalmerol/bugfix/prlimit
Browse files Browse the repository at this point in the history
use prlimit on pbs client + remove partial file scan on <10mb
  • Loading branch information
sonroyaalmerol authored Dec 24, 2024
2 parents 6778c15 + 753152f commit 07f6aeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions internal/agent/sftp/filelister.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"os"
"path/filepath"
"strings"
"syscall"
"time"

"github.com/pkg/sftp"
"github.com/sonroyaalmerol/pbs-plus/internal/agent/cache"
Expand All @@ -33,14 +31,16 @@ func (f *CustomFileInfo) Size() int64 {
}
}

if !scanFile && metadataSize <= 10*1024*1024 {
d := f.Sys().(*syscall.Win32FileAttributeData)
cTime := time.Unix(0, d.CreationTime.Nanoseconds())
/*
if !scanFile && metadataSize <= 1*1024*1024 {
d := f.Sys().(*syscall.Win32FileAttributeData)
cTime := time.Unix(0, d.CreationTime.Nanoseconds())
if f.ModTime().Before(cTime) {
scanFile = true
if f.ModTime().Before(cTime) {
scanFile = true
}
}
}
*/

if !scanFile {
return metadataSize
Expand Down
4 changes: 3 additions & 1 deletion internal/backend/backup/jobrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func RunBackup(job *store.Job, storeInstance *store.Store, waitChan chan struct{
}

cmdArgs := []string{
"--nofile=1024:1024",
"/usr/bin/proxmox-backup-client",
"backup",
fmt.Sprintf("%s.pxar:%s", strings.ReplaceAll(job.Target, " ", "-"), srcPath),
"--repository",
Expand All @@ -136,7 +138,7 @@ func RunBackup(job *store.Job, storeInstance *store.Store, waitChan chan struct{

_ = FixDatastore(job, storeInstance)

cmd := exec.Command("/usr/bin/proxmox-backup-client", cmdArgs...)
cmd := exec.Command("/usr/bin/prlimit", cmdArgs...)
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, fmt.Sprintf("PBS_PASSWORD=%s", storeInstance.APIToken.Value))

Expand Down

0 comments on commit 07f6aeb

Please sign in to comment.