forked from vitalif/vitastor
Simplify & fix monitor stats aggregation
parent
4d43774cbb
commit
6e6f407df3
17
mon/mon.js
17
mon/mon.js
|
@ -360,6 +360,7 @@ class Mon
|
|||
}
|
||||
}
|
||||
await this.recheck_pgs();
|
||||
this.schedule_update_stats();
|
||||
}
|
||||
|
||||
async load_config()
|
||||
|
@ -401,11 +402,6 @@ class Mon
|
|||
{
|
||||
this.config.mon_stats_timeout = 100;
|
||||
}
|
||||
this.config.mon_stats_interval = Number(this.config.mon_stats_interval) || 5000;
|
||||
if (this.config.mon_stats_interval < 100)
|
||||
{
|
||||
this.config.mon_stats_interval = 100;
|
||||
}
|
||||
// After this number of seconds, a dead OSD will be removed from PG distribution
|
||||
this.config.osd_out_time = Number(this.config.osd_out_time) || 0;
|
||||
if (!this.config.osd_out_time)
|
||||
|
@ -1404,20 +1400,13 @@ class Mon
|
|||
{
|
||||
if (this.stats_timer)
|
||||
{
|
||||
clearTimeout(this.stats_timer);
|
||||
this.stats_timer = null;
|
||||
}
|
||||
let sleep = (this.stats_update_next||0) - Date.now();
|
||||
if (sleep < this.config.mon_stats_timeout)
|
||||
{
|
||||
sleep = this.config.mon_stats_timeout;
|
||||
return;
|
||||
}
|
||||
this.stats_timer = setTimeout(() =>
|
||||
{
|
||||
this.stats_timer = null;
|
||||
this.stats_update_next = Date.now() + this.config.mon_stats_interval;
|
||||
this.update_total_stats().catch(console.error);
|
||||
}, sleep);
|
||||
}, this.config.mon_stats_timeout);
|
||||
}
|
||||
|
||||
parse_kv(kv)
|
||||
|
|
Loading…
Reference in New Issue