Skip to content

Commit

Permalink
Revert back to wasm_timer for interval
Browse files Browse the repository at this point in the history
  • Loading branch information
AgeManning committed Feb 10, 2022
1 parent 861e15d commit 7b4dceb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 213 deletions.
1 change: 1 addition & 0 deletions protocols/gossipsub/Cargo.toml
Expand Up @@ -33,6 +33,7 @@ instant = "0.1.11"
serde = { version = "1", optional = true, features = ["derive"] }
# Metrics dependencies
prometheus-client = "0.15.0"
wasm-timer = "0.2.5"

[dev-dependencies]
async-std = "1.6.3"
Expand Down
7 changes: 4 additions & 3 deletions protocols/gossipsub/src/behaviour.rs
Expand Up @@ -46,6 +46,7 @@ use libp2p_swarm::{
IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, PollParameters,
};

use crate::backoff::BackoffStorage;
use crate::config::{GossipsubConfig, ValidationMode};
use crate::error::{PublishError, SubscriptionError, ValidationError};
use crate::gossip_promises::GossipPromises;
Expand All @@ -63,9 +64,9 @@ use crate::types::{
GossipsubSubscriptionAction, MessageAcceptance, MessageId, PeerInfo, RawGossipsubMessage,
};
use crate::types::{GossipsubRpc, PeerConnections, PeerKind};
use crate::{backoff::BackoffStorage, interval::Interval};
use crate::{rpc_proto, TopicScoreParams};
use std::{cmp::Ordering::Equal, fmt::Debug};
use wasm_timer::Interval;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -439,8 +440,8 @@ where
config.backoff_slack(),
),
mcache: MessageCache::new(config.history_gossip(), config.history_length()),
heartbeat: Interval::new_initial(
config.heartbeat_initial_delay(),
heartbeat: Interval::new_at(
Instant::now() + config.heartbeat_initial_delay(),
config.heartbeat_interval(),
),
heartbeat_ticks: 0,
Expand Down
209 changes: 0 additions & 209 deletions protocols/gossipsub/src/interval.rs

This file was deleted.

1 change: 0 additions & 1 deletion protocols/gossipsub/src/lib.rs
Expand Up @@ -142,7 +142,6 @@ mod behaviour;
mod config;
mod gossip_promises;
mod handler;
mod interval;
mod mcache;
pub mod metrics;
mod peer_score;
Expand Down

0 comments on commit 7b4dceb

Please sign in to comment.