Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protocols/gossipsub: Revert back to wasm_timer for interval #2506

Merged
merged 10 commits into from Feb 14, 2022
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