node: update stats less frequently, wait on restart
This commit is contained in:
parent
975c5d0576
commit
d084fd6b59
1 changed files with 2 additions and 4 deletions
|
@ -79,7 +79,7 @@ impl Default for Node {
|
||||||
|
|
||||||
impl Node {
|
impl Node {
|
||||||
/// Delay for thread to update the stats.
|
/// Delay for thread to update the stats.
|
||||||
pub const STATS_UPDATE_DELAY: Duration = Duration::from_millis(250);
|
pub const STATS_UPDATE_DELAY: Duration = Duration::from_millis(1000);
|
||||||
|
|
||||||
/// Stop the [`Server`] and setup exit flag after if needed.
|
/// Stop the [`Server`] and setup exit flag after if needed.
|
||||||
pub fn stop(exit_after_stop: bool) {
|
pub fn stop(exit_after_stop: bool) {
|
||||||
|
@ -212,15 +212,13 @@ impl Node {
|
||||||
let mut first_start = true;
|
let mut first_start = true;
|
||||||
loop {
|
loop {
|
||||||
if Self::is_restarting() {
|
if Self::is_restarting() {
|
||||||
// Stop the server.
|
|
||||||
server.stop();
|
server.stop();
|
||||||
|
thread::sleep(Duration::from_millis(5000));
|
||||||
// Reset stratum stats
|
// Reset stratum stats
|
||||||
{
|
{
|
||||||
let mut w_stratum_stats = NODE_STATE.stratum_stats.write();
|
let mut w_stratum_stats = NODE_STATE.stratum_stats.write();
|
||||||
*w_stratum_stats = StratumStats::default();
|
*w_stratum_stats = StratumStats::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new server.
|
// Create new server.
|
||||||
match start_node_server() {
|
match start_node_server() {
|
||||||
Ok(s) => {
|
Ok(s) => {
|
||||||
|
|
Loading…
Reference in a new issue