Skip to content

Commit

Permalink
feat: add default DiskGCThresholdPercent and ignore it when is 0 (#971)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ma <[email protected]>
  • Loading branch information
jim3ma committed Dec 31, 2021
1 parent edcdc9b commit 8bd7b70
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions client/config/peerhost_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ var peerHostConfig = DaemonOption{
TaskExpireTime: clientutil.Duration{
Duration: DefaultTaskExpireTime,
},
StoreStrategy: AdvanceLocalTaskStoreStrategy,
Multiplex: false,
StoreStrategy: AdvanceLocalTaskStoreStrategy,
Multiplex: false,
DiskGCThresholdPercent: 95,
},
}
5 changes: 3 additions & 2 deletions client/config/peerhost_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ var peerHostConfig = DaemonOption{
TaskExpireTime: clientutil.Duration{
Duration: DefaultTaskExpireTime,
},
StoreStrategy: AdvanceLocalTaskStoreStrategy,
Multiplex: false,
StoreStrategy: AdvanceLocalTaskStoreStrategy,
Multiplex: false,
DiskGCThresholdPercent: 95,
},
}
3 changes: 3 additions & 0 deletions client/daemon/storage/storage_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ func (s *storageManager) forceGC() (bool, error) {
}

func (s *storageManager) diskUsageExceed() (exceed bool, bytes int64) {
if s.storeOption.DiskGCThresholdPercent <= 0 {
return false, 0
}
usage, err := disk.Usage(s.storeOption.DataPath)
if err != nil {
logger.Warnf("get %s disk usage error: %s", s.storeOption.DataPath, err)
Expand Down

0 comments on commit 8bd7b70

Please sign in to comment.