mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Large cluster optimizations. (#348)
* Added sync log to streamer. * Fixed ledger closing attempt while syncing. * Added diagnostic contract. * Reset to stage 0 on unreliable votes. * Reduced peer msg age threshold. * Added health tracking. * Weakly-connected detection improvement. * Increased version 0.5.1. * Improved client lib server version check. * Added health logging support to text client. * Added weakly connected status in status response. * Increased max peers limits when serializing. * Local docker cluster manual ip. * Updated vultr script vm region order. * Sync status reporting improvement. * Added milliseconds to logging.
This commit is contained in:
@@ -7,7 +7,8 @@ namespace usr
|
||||
enum NOTIFICATION_CHANNEL
|
||||
{
|
||||
UNL_CHANGE = 0,
|
||||
LEDGER_EVENT = 1
|
||||
LEDGER_EVENT = 1,
|
||||
HEALTH_STAT = 2
|
||||
};
|
||||
|
||||
} // namespace usr
|
||||
|
||||
@@ -609,6 +609,24 @@ namespace usr
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ev.index() == 3) // Health events. Broadcast for subscribed users.
|
||||
{
|
||||
std::scoped_lock<std::mutex> lock(ctx.users_mutex);
|
||||
for (auto &[sid, user] : ctx.users)
|
||||
{
|
||||
if (user.subscriptions[NOTIFICATION_CHANNEL::HEALTH_STAT])
|
||||
{
|
||||
std::vector<uint8_t> &msg = protocol_msgs[user.protocol];
|
||||
if (msg.empty()) // Construct the message with relevant protocol if not done so already.
|
||||
{
|
||||
msg::usrmsg::usrmsg_parser parser(user.protocol);
|
||||
const status::health_event &health_ev = std::get<status::health_event>(ev);
|
||||
parser.create_health_notification(msg, health_ev);
|
||||
}
|
||||
user.session.send(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace usr
|
||||
size_t collected_input_size = 0;
|
||||
|
||||
// User's notification subscription toggles.
|
||||
bool subscriptions[2];
|
||||
bool subscriptions[3];
|
||||
|
||||
// Holds the websocket session of this user.
|
||||
// We don't need to own the session object since the lifetime of user and session are coupled.
|
||||
@@ -55,6 +55,7 @@ namespace usr
|
||||
// Default subscriptions.
|
||||
subscriptions[NOTIFICATION_CHANNEL::UNL_CHANGE] = false;
|
||||
subscriptions[NOTIFICATION_CHANNEL::LEDGER_EVENT] = false;
|
||||
subscriptions[NOTIFICATION_CHANNEL::HEALTH_STAT] = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user