Skip to content

Commit

Permalink
fix edge case in Database::recentIdleDbPercent
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsieurNicolas committed Mar 7, 2018
1 parent 7b453ea commit 89b10a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/database/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ Database::recentIdleDbPercent()
std::chrono::nanoseconds total = mApp.getClock().now() - mLastIdleTotalTime;
total -= mExcludedTotalTime;

if (total == std::chrono::nanoseconds::zero())
{
return 100;
}

uint32_t queryPercent =
static_cast<uint32_t>((100 * query.count()) / total.count());
uint32_t idlePercent = 100 - queryPercent;
Expand Down

5 comments on commit 89b10a1

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from MonsieurNicolas
at MonsieurNicolas@89b10a1

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging MonsieurNicolas/stellar-core/prefPeersAlways = 89b10a1 into auto

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MonsieurNicolas/stellar-core/prefPeersAlways = 89b10a1 merged ok, testing candidate = 74cae1e

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@latobarita
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 74cae1e

Please sign in to comment.