Skip to content

Commit

Permalink
Support HTTP health check in reporting mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Travis authored and nbougalis committed Apr 1, 2021
1 parent c0a0b79 commit 9c8cadd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/ripple/app/ledger/impl/LedgerMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,25 @@ bool
LedgerMaster::isCaughtUp(std::string& reason)
{
using namespace std::chrono_literals;

#ifdef RIPPLED_REPORTING
if (app_.config().reporting())
{
auto age = PgQuery(app_.getPgPool())("SELECT age()");
if (!age || age.isNull())
{
reason = "No ledgers in database";
return false;
}
if (std::chrono::seconds{age.asInt()} > 3min)
{
reason = "No recently-published ledger";
return false;
}
return true;
}
#endif

if (getPublishedLedgerAge() > 3min)
{
reason = "No recently-published ledger";
Expand Down

0 comments on commit 9c8cadd

Please sign in to comment.