mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Support HTTP health check in reporting mode.
This commit is contained in:
committed by
Nik Bougalis
parent
c0a0b79d2d
commit
9c8caddc5a
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user