Skip to content

Commit

Permalink
chore: upgrade tentacle
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Nov 20, 2024
1 parent f99e0be commit 02cc687
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions network/src/services/dump_peer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ const DEFAULT_DUMP_INTERVAL: Duration = Duration::from_secs(3600); // 1 hour
/// Save current peer store data regularly
pub struct DumpPeerStoreService {
network_state: Arc<NetworkState>,
#[cfg(not(target_family = "wasm"))]
interval: Option<tokio::time::Interval>,
#[cfg(target_family = "wasm")]
interval: Option<p2p::runtime::Interval>,
}

Expand Down Expand Up @@ -57,27 +54,6 @@ impl Drop for DumpPeerStoreService {
impl Future for DumpPeerStoreService {
type Output = ();

#[cfg(not(target_family = "wasm"))]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
if self.interval.is_none() {
self.interval = {
let mut interval = tokio::time::interval_at(
tokio::time::Instant::now() + DEFAULT_DUMP_INTERVAL,
DEFAULT_DUMP_INTERVAL,
);
// The dump peer store service does not need to urgently compensate for the missed wake,
// just delay behavior is enough
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
Some(interval)
}
}
while self.interval.as_mut().unwrap().poll_tick(cx).is_ready() {
self.dump_peer_store()
}
Poll::Pending
}

#[cfg(target_family = "wasm")]
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
use futures::StreamExt;
if self.interval.is_none() {
Expand Down

0 comments on commit 02cc687

Please sign in to comment.