Skip to content

Commit

Permalink
checking before decrementing pending count
Browse files Browse the repository at this point in the history
  • Loading branch information
diptanu committed Aug 3, 2024
1 parent c40ca1e commit 15ed42e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/indexify_internal_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,17 @@ impl TaskAnalytics {

pub fn success(&mut self) {
self.successful_tasks += 1;
self.pending_tasks -= 1;
// This is for upgrade path from older versions
if self.pending_tasks > 0 {
self.pending_tasks -= 1;
}
}

pub fn fail(&mut self) {
self.failed_tasks += 1;
self.pending_tasks -= 1;
if self.pending_tasks > 0 {
self.pending_tasks -= 1;
}
}
}

Expand Down

0 comments on commit 15ed42e

Please sign in to comment.