Merge pull request #355 from bachandi/fix_du_refresh_interval

Fix du refresh interval setting for values that are not multiples of 60.
This commit is contained in:
Jordi Sanfeliu 2021-10-01 08:49:22 +02:00 committed by GitHub
commit 25de78d2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -170,11 +170,11 @@ sub du_update {
my $rrdata = "N";
my $refresh_interval = ($config->{du}->{refresh_interval} || 0);
if($refresh_interval > 0) {
if($refresh_interval > 60) {
# If desired refreshed only every refresh_interval seconds.
# This logic will refresh atleast once a day.
my (undef, $min, $hour) = localtime(time);
return if(60 * ($min + 60 * $hour) % $refresh_interval);
return if(($min + 60 * $hour) % int($refresh_interval / 60));
}
my $e = 0;