scanner status command(3)

Signed-off-by: mujunxiang <1948535941@qq.com>
This commit is contained in:
mujunxiang
2024-12-03 10:14:46 +08:00
parent f707639392
commit bedc81e973
3 changed files with 10 additions and 11 deletions
+2 -2
View File
@@ -9,11 +9,11 @@ use std::{
atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering}, atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering},
Arc, Arc,
}, },
time::{Duration, SystemTime, UNIX_EPOCH}, time::{Duration, SystemTime},
}; };
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use chrono::{DateTime, TimeZone, Utc}; use chrono::{DateTime, Utc};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use rand::Rng; use rand::Rng;
use rmp_serde::{Deserializer, Serializer}; use rmp_serde::{Deserializer, Serializer};
+2 -5
View File
@@ -1,4 +1,4 @@
use chrono::{DateTime, Utc}; use chrono::Utc;
use common::globals::GLOBAL_Local_Node_Name; use common::globals::GLOBAL_Local_Node_Name;
use common::last_minute::{AccElem, LastMinuteLatency}; use common::last_minute::{AccElem, LastMinuteLatency};
use lazy_static::lazy_static; use lazy_static::lazy_static;
@@ -10,10 +10,7 @@ use std::sync::Once;
use std::time::{Duration, UNIX_EPOCH}; use std::time::{Duration, UNIX_EPOCH};
use std::{ use std::{
collections::HashMap, collections::HashMap,
sync::{ sync::{atomic::Ordering, Arc},
atomic::{AtomicU32, Ordering},
Arc,
},
time::SystemTime, time::SystemTime,
}; };
use tokio::sync::RwLock; use tokio::sync::RwLock;
+6 -4
View File
@@ -39,10 +39,9 @@ use std::task::{Context, Poll};
use std::time::Duration as std_Duration; use std::time::Duration as std_Duration;
use std::u64; use std::u64;
use time::{Duration, OffsetDateTime}; use time::{Duration, OffsetDateTime};
use tokio::spawn; use tokio::sync::mpsc::{self};
use tokio::sync::mpsc::error::TryRecvError;
use tokio::sync::mpsc::{self, Receiver};
use tokio::time::interval; use tokio::time::interval;
use tokio::{select, spawn};
use tokio_stream::wrappers::ReceiverStream; use tokio_stream::wrappers::ReceiverStream;
use tracing::{error, info, warn}; use tracing::{error, info, warn};
@@ -446,7 +445,10 @@ impl Operation for MetricsHandler {
break; break;
} }
interval.tick().await; select! {
_ = tx.closed() => { return; }
_ = interval.tick() => {}
}
} }
}); });