Skip to content

Commit 570e0a6

Browse files
authored
refactor: remove unused async from functions (#571)
* fix unused async warnings * remove unneeded #cfg[test] fns * fix test
1 parent 32cd7ac commit 570e0a6

File tree

15 files changed

+230
-206
lines changed

15 files changed

+230
-206
lines changed

crates/dev-utils/examples/submit_work.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ async fn main() -> Result<()> {
5454
let call = contracts
5555
.compute_pool
5656
.build_work_submission_call(pool_id, node, work_key, U256::from(179949060096000.0))
57-
.await
5857
.map_err(|e| eyre::eyre!("Failed to build work submission call: {}", e))?;
5958

6059
let tx = call

crates/discovery/src/chainsync/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl ChainSync {
121121
}
122122
}
123123

124-
pub async fn run(self) -> Result<(), Error> {
124+
pub fn run(self) -> Result<(), Error> {
125125
let ChainSync {
126126
node_store,
127127
cancel_token,

crates/discovery/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async fn main() -> Result<()> {
119119
contracts.clone(),
120120
last_chain_sync.clone(),
121121
);
122-
chain_sync.run().await?;
122+
chain_sync.run()?;
123123

124124
// Start location enrichment service if enabled
125125
if let Some(location_url) = args.location_service_url.clone() {

crates/orchestrator/src/metrics/webhook_sender.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ impl MetricsWebhookSender {
7070
if Self::metrics_changed(&metrics, &self.last_sent_metrics) {
7171
info!("Sending {} metrics via webhook", metrics.len());
7272
for plugin in &self.webhook_plugins {
73-
let _ = plugin
74-
.send_metrics_updated(self.pool_id, metrics.clone())
75-
.await;
73+
let _ = plugin.send_metrics_updated(self.pool_id, metrics.clone());
7674
}
7775
// Update last sent metrics
7876
self.last_sent_metrics = metrics.clone();

crates/orchestrator/src/plugins/node_groups/mod.rs

Lines changed: 30 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -622,20 +622,13 @@ impl NodeGroupsPlugin {
622622
for group in webhook_groups {
623623
if let Some(plugins) = &self.webhook_plugins {
624624
for plugin in plugins.iter() {
625-
let group_clone = group.clone();
626-
let plugin_clone = plugin.clone();
627-
tokio::spawn(async move {
628-
if let Err(e) = plugin_clone
629-
.send_group_created(
630-
group_clone.id.to_string(),
631-
group_clone.configuration_name.to_string(),
632-
group_clone.nodes.iter().cloned().collect(),
633-
)
634-
.await
635-
{
636-
error!("Failed to send group created webhook: {e}");
637-
}
638-
});
625+
if let Err(e) = plugin.send_group_created(
626+
group.id.clone(),
627+
group.configuration_name.clone(),
628+
group.nodes.iter().cloned().collect(),
629+
) {
630+
error!("Failed to send group created webhook: {}", e);
631+
}
639632
}
640633
}
641634
}
@@ -981,51 +974,36 @@ impl NodeGroupsPlugin {
981974
}
982975

983976
// Send webhook notifications
984-
self.send_merge_webhooks(groups_to_merge, &merged_group)
985-
.await;
977+
self.send_merge_webhooks(groups_to_merge, &merged_group);
986978

987979
Ok(Some((merged_group, group_ids_to_dissolve)))
988980
}
989981

990982
/// Send webhook notifications for group merging
991-
async fn send_merge_webhooks(&self, dissolved_groups: &[NodeGroup], merged_group: &NodeGroup) {
983+
fn send_merge_webhooks(&self, dissolved_groups: &[NodeGroup], merged_group: &NodeGroup) {
992984
if let Some(plugins) = &self.webhook_plugins {
993985
// Send dissolved notifications
994986
for group in dissolved_groups {
995987
for plugin in plugins.iter() {
996-
let plugin_clone = plugin.clone();
997-
let group_clone = group.clone();
998-
tokio::spawn(async move {
999-
if let Err(e) = plugin_clone
1000-
.send_group_destroyed(
1001-
group_clone.id,
1002-
group_clone.configuration_name,
1003-
group_clone.nodes.iter().cloned().collect(),
1004-
)
1005-
.await
1006-
{
1007-
error!("Failed to send group dissolved webhook: {e}");
1008-
}
1009-
});
988+
if let Err(e) = plugin.send_group_destroyed(
989+
group.id.clone(),
990+
group.configuration_name.clone(),
991+
group.nodes.iter().cloned().collect(),
992+
) {
993+
error!("Failed to send group dissolved webhook: {}", e);
994+
}
1010995
}
1011996
}
1012997

1013998
// Send created notification
1014999
for plugin in plugins.iter() {
1015-
let plugin_clone = plugin.clone();
1016-
let group_clone = merged_group.clone();
1017-
tokio::spawn(async move {
1018-
if let Err(e) = plugin_clone
1019-
.send_group_created(
1020-
group_clone.id,
1021-
group_clone.configuration_name,
1022-
group_clone.nodes.iter().cloned().collect(),
1023-
)
1024-
.await
1025-
{
1026-
error!("Failed to send group created webhook: {e}");
1027-
}
1028-
});
1000+
if let Err(e) = plugin.send_group_created(
1001+
merged_group.id.clone(),
1002+
merged_group.configuration_name.clone(),
1003+
merged_group.nodes.iter().cloned().collect(),
1004+
) {
1005+
error!("Failed to send group created webhook: {}", e);
1006+
}
10291007
}
10301008
}
10311009
}
@@ -1098,20 +1076,13 @@ impl NodeGroupsPlugin {
10981076
);
10991077
if let Some(plugins) = &self.webhook_plugins {
11001078
for plugin in plugins.iter() {
1101-
let plugin_clone = plugin.clone();
1102-
let group_clone = group.clone();
1103-
tokio::spawn(async move {
1104-
if let Err(e) = plugin_clone
1105-
.send_group_destroyed(
1106-
group_clone.id.to_string(),
1107-
group_clone.configuration_name.to_string(),
1108-
group_clone.nodes.iter().cloned().collect(),
1109-
)
1110-
.await
1111-
{
1112-
error!("Failed to send group dissolved webhook: {e}");
1113-
}
1114-
});
1079+
if let Err(e) = plugin.send_group_destroyed(
1080+
group.id.clone(),
1081+
group.configuration_name.clone(),
1082+
group.nodes.iter().cloned().collect(),
1083+
) {
1084+
error!("Failed to send group dissolved webhook: {}", e);
1085+
}
11151086
}
11161087
}
11171088
} else {

0 commit comments

Comments
 (0)