Skip to content

Commit 87ee180

Browse files
committed
some rfks, todo add network as a mod?
1 parent bd8d050 commit 87ee180

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

compute/src/handlers/workflow.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ impl ComputeHandler for WorkflowHandler {
161161
};
162162

163163
// try publishing the result
164-
165164
if let Err(publish_err) = node.publish(message) {
166165
let err_msg = format!("Could not publish result: {:?}", publish_err);
167166
log::error!("{}", err_msg);

compute/src/node.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ impl DriaComputeNode {
156156
log::debug!("{:?}", self.p2p.network_info().connection_counters());
157157
}
158158

159-
160-
161159
let (peer_id, message_id, message) = event;
162160
let topic = message.topic.clone();
163161
let topic_str = topic.as_str();

compute/src/utils/available_nodes/mod.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ use crate::DriaNetworkType;
1111
/// Number of seconds between refreshing the available nodes.
1212
const DEFAULT_REFRESH_INTERVAL_SECS: u64 = 25;
1313

14+
impl DriaNetworkType {
15+
/// Returns the URL for fetching available nodes w.r.t network type.
16+
pub fn get_available_nodes_url(&self) -> &str {
17+
match self {
18+
DriaNetworkType::Community => "https://dkn.dria.co/available-nodes",
19+
DriaNetworkType::Pro => "https://dkn.dria.co/sdk/available-nodes",
20+
}
21+
}
22+
}
1423
/// Available nodes within the hybrid P2P network.
1524
///
1625
/// - Bootstrap: used for Kademlia DHT bootstrap.
@@ -98,11 +107,7 @@ impl AvailableNodes {
98107
}
99108

100109
// make the request w.r.t network type
101-
let url = match self.network_type {
102-
DriaNetworkType::Community => "https://dkn.dria.co/available-nodes",
103-
DriaNetworkType::Pro => "https://dkn.dria.co/sdk/available-nodes",
104-
};
105-
let response = reqwest::get(url).await?;
110+
let response = reqwest::get(self.network_type.get_available_nodes_url()).await?;
106111
let response_body = response.json::<AvailableNodesApiResponse>().await?;
107112
self.bootstrap_nodes
108113
.extend(parse_vec(response_body.bootstraps).into_iter());

0 commit comments

Comments
 (0)