Support HTTP health check in reporting mode.

This commit is contained in:
Mark Travis
2021-03-29 09:17:56 -07:00
committed by Nik Bougalis
parent c0a0b79d2d
commit 9c8caddc5a

View File

@@ -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";