Tick before increment, tick on fetch

This commit is contained in:
asonix 2018-12-18 17:09:10 -06:00
parent c6682d2fc9
commit 2fea1e8e69
No known key found for this signature in database
GPG key ID: 6986797E36BFA1D4

View file

@ -852,10 +852,13 @@ impl Stat {
} }
fn inner_stat(self) -> JobStat { fn inner_stat(self) -> JobStat {
match self { let mut job_stat = match self {
Stat::DeadJobs(job_stat) => job_stat, Stat::DeadJobs(job_stat) => job_stat,
Stat::CompletedJobs(job_stat) => job_stat, Stat::CompletedJobs(job_stat) => job_stat,
} };
job_stat.tick();
job_stat
} }
fn dead_jobs() -> &'static str { fn dead_jobs() -> &'static str {
@ -898,12 +901,12 @@ impl JobStat {
} }
fn increment(&mut self) { fn increment(&mut self) {
self.tick();
self.this_hour += 1; self.this_hour += 1;
self.today += 1; self.today += 1;
self.this_month += 1; self.this_month += 1;
self.all_time += 1; self.all_time += 1;
self.tick();
} }
fn tick(&mut self) { fn tick(&mut self) {