Skip to content

Commit

Permalink
network-libp2p: Shorten the DHT query timeout
Browse files Browse the repository at this point in the history
Shorten the DHT query timeout and make sure that the partial DHT
results are removed on an error.
  • Loading branch information
jsdanielh committed Jan 26, 2024
1 parent 49cb6a9 commit 4ed7d63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions network-libp2p/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ impl Config {
kademlia.set_kbucket_inserts(kad::BucketInserts::OnConnected);
kademlia.set_record_ttl(Some(Duration::from_secs(5 * 60)));
kademlia.set_publication_interval(Some(Duration::from_secs(60)));
kademlia.set_query_timeout(Duration::from_secs(10));

// Since we have a record TTL of 5 minutes, record replication is not needed right now
kademlia.set_replication_interval(None);
Expand Down
1 change: 1 addition & 0 deletions network-libp2p/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ impl Network {
} else {
warn!(query_id = ?id, ?step, query_error=?error, "GetRecord query result error for unknown query ID");
}
state.dht_get_results.remove(&id);
}
QueryResult::PutRecord(result) => {
// dht_put resolved
Expand Down

0 comments on commit 4ed7d63

Please sign in to comment.