Allow disabling disk checking with 0 value for check interval
This commit is contained in:
parent
ffb6bd72ef
commit
8081c83de4
|
@ -47,12 +47,6 @@ type Configuration struct {
|
|||
System SystemConfiguration `json:"system" yaml:"system"`
|
||||
Docker DockerConfiguration `json:"docker" yaml:"docker"`
|
||||
|
||||
// The amount of time in seconds that should elapse between disk usage checks
|
||||
// run by the daemon. Setting a higher number can result in better IO performance
|
||||
// at an increased risk of a malicious user creating a process that goes over
|
||||
// the assigned disk limits.
|
||||
DiskCheckTimeout int `yaml:"disk_check_timeout"`
|
||||
|
||||
// Defines internal throttling configurations for server processes to prevent
|
||||
// someone from running an endless loop that spams data to logs.
|
||||
Throttles ConsoleThrottles
|
||||
|
|
|
@ -53,6 +53,10 @@ type SystemConfiguration struct {
|
|||
// considered stale and a re-check should occur. DANGER: setting this value too low can seriously
|
||||
// impact system performance and cause massive I/O bottlenecks and high CPU usage for the Wings
|
||||
// process.
|
||||
//
|
||||
// Set to 0 to disable disk checking entirely. This will always return 0 for the disk space used
|
||||
// by a server and should only be set in extreme scenarios where performance is critical and
|
||||
// disk usage is not a concern.
|
||||
DiskCheckInterval int64 `default:"150" yaml:"disk_check_interval"`
|
||||
|
||||
// Determines if Wings should detect a server that stops with a normal exit code of
|
||||
|
|
|
@ -97,6 +97,11 @@ func (fs *Filesystem) CachedUsage() int64 {
|
|||
// This is primarily to avoid a bunch of I/O operations from piling up on the server, especially on servers
|
||||
// with a large amount of files.
|
||||
func (fs *Filesystem) DiskUsage(allowStaleValue bool) (int64, error) {
|
||||
// A disk check interval of 0 means this functionality is completely disabled.
|
||||
if fs.diskCheckInterval == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
if !fs.lastLookupTime.Get().After(time.Now().Add(time.Second * fs.diskCheckInterval * -1)) {
|
||||
// If we are now allowing a stale response go ahead and perform the lookup and return the fresh
|
||||
// value. This is a blocking operation to the calling process.
|
||||
|
|
Loading…
Reference in New Issue
Block a user