mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-20 15:05:19 +00:00
stat only 10 mins
This commit is contained in:
parent
15aca2d386
commit
2efa91987e
@ -99,6 +99,8 @@ pub struct Libp2pEventHandler {
|
|||||||
file_batcher: RwLock<Batcher<TxID>>,
|
file_batcher: RwLock<Batcher<TxID>>,
|
||||||
/// Announcements to publish in batch
|
/// Announcements to publish in batch
|
||||||
announcement_batcher: RwLock<Batcher<SignedAnnounceFile>>,
|
announcement_batcher: RwLock<Batcher<SignedAnnounceFile>>,
|
||||||
|
|
||||||
|
since: Instant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Libp2pEventHandler {
|
impl Libp2pEventHandler {
|
||||||
@ -138,6 +140,7 @@ impl Libp2pEventHandler {
|
|||||||
peers,
|
peers,
|
||||||
file_batcher,
|
file_batcher,
|
||||||
announcement_batcher,
|
announcement_batcher,
|
||||||
|
since: Instant::now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +328,8 @@ impl Libp2pEventHandler {
|
|||||||
self.on_find_chunks(msg).await
|
self.on_find_chunks(msg).await
|
||||||
}
|
}
|
||||||
PubsubMessage::AnnounceFile(msgs) => {
|
PubsubMessage::AnnounceFile(msgs) => {
|
||||||
|
let elapsed = self.since.elapsed().as_secs();
|
||||||
|
if elapsed > 600 && elapsed < 1200 {
|
||||||
let txs = msgs
|
let txs = msgs
|
||||||
.iter()
|
.iter()
|
||||||
.map(|file| file.tx_ids.iter().map(|x| x.seq).collect::<Vec<u64>>())
|
.map(|file| file.tx_ids.iter().map(|x| x.seq).collect::<Vec<u64>>())
|
||||||
@ -333,6 +338,7 @@ impl Libp2pEventHandler {
|
|||||||
"qbit: received file announcement, propagation={}, source={}, txs={:?}",
|
"qbit: received file announcement, propagation={}, source={}, txs={:?}",
|
||||||
propagation_source, source, txs
|
propagation_source, source, txs
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
metrics::LIBP2P_HANDLE_PUBSUB_ANNOUNCE_FILE.mark(1);
|
metrics::LIBP2P_HANDLE_PUBSUB_ANNOUNCE_FILE.mark(1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user