mirror of
https://github.com/EvernodeXRPL/sashimono.git
synced 2026-07-30 18:40:29 +00:00
Merge branch 'hooks-v2' into beta1
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# surrounding braces are needed make the whole script to be buffered on client before execution.
|
||||
{
|
||||
|
||||
evernode="Evernode beta"
|
||||
evernode="Evernode Beta v2"
|
||||
maxmind_creds="687058:FtcQjM0emHFMEfgI"
|
||||
cgrulesengd_default="cgrulesengd"
|
||||
alloc_ratio=80
|
||||
@@ -639,7 +639,7 @@ function install_evernode() {
|
||||
# Currently the domain address saved only in account_info and an empty value in Hook states )
|
||||
description=""
|
||||
|
||||
echo "Installing Sashimono..."
|
||||
echo "Installing Sashimono on Evernode Beta V2 (Disabled Network)..."
|
||||
# Filter logs with STAGE prefix and ommit the prefix when echoing.
|
||||
# If STAGE log contains -p arg, move the cursor to previous log line and overwrite the log.
|
||||
! UPGRADE=$upgrade ./sashimono-install.sh $inetaddr $init_peer_port $init_user_port $countrycode $alloc_instcount \
|
||||
|
||||
@@ -333,21 +333,26 @@ class MessageBoard {
|
||||
async #startHeartBeatScheduler() {
|
||||
// Sending a heartbeat at startup
|
||||
await this.#sendHeartbeat();
|
||||
|
||||
const timeout = this.hostClient.config.momentSize * 1000; // Seconds to millisecs.
|
||||
|
||||
|
||||
const momentSize = this.hostClient.config.momentSize;
|
||||
const halfMomentSize = momentSize / 2; // Getting half of moment size
|
||||
const timeout = momentSize * 1000; // Converting seconds to milliseconds.
|
||||
|
||||
const scheduler = async () => {
|
||||
setTimeout(async () => {
|
||||
await scheduler();
|
||||
}, timeout);
|
||||
await this.#sendHeartbeat();
|
||||
};
|
||||
|
||||
const nextMomentStartIdx = await this.hostClient.getMomentStartIndex() + this.hostClient.config.momentSize;
|
||||
|
||||
const currentMomentStartIdx = await this.hostClient.getMomentStartIndex();
|
||||
|
||||
// If the start index is in the begining of the moment, delay the heartbeat scheduler 1 minute to make sure the hook timestamp is not in previous moment when accepting the heartbeat.
|
||||
const startTimeout = (evernode.UtilHelpers.getCurrentUnixTime() - currentMomentStartIdx) < halfMomentSize ? ((momentSize + 60) * 1000) : ((momentSize) * 1000);
|
||||
|
||||
setTimeout(async () => {
|
||||
await scheduler();
|
||||
}, (nextMomentStartIdx - evernode.UtilHelpers.getCurrentUnixTime() + 60) * 1000);
|
||||
// Delay the heartbeat scheduler 1 minute to make sure the hook timestamp is not in previous moment when accepting the heartbeat.
|
||||
}, startTimeout);
|
||||
}
|
||||
|
||||
// Try to acquire the lease update lock.
|
||||
|
||||
Reference in New Issue
Block a user