Skip to content

Commit 2763df0

Browse files
committed
remove extraneous async from observer functions
1 parent 499e25c commit 2763df0

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

crates/sui-core/src/authority/execution_time_estimator.rs

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ impl ExecutionTimeObserver {
127127
}
128128
Some((tx, timings, total_duration)) = rx_local_execution_time.recv() => {
129129
observer
130-
.record_local_observations(&tx, &timings, total_duration)
131-
.await;
130+
.record_local_observations(&tx, &timings, total_duration);
132131
}
133132
else => { break }
134133
}
@@ -173,7 +172,7 @@ impl ExecutionTimeObserver {
173172
// Updates moving averages and submits observation to consensus if local observation differs
174173
// from consensus median.
175174
// TODO: Consider more detailed heuristic to account for overhead outside of commands.
176-
async fn record_local_observations(
175+
fn record_local_observations(
177176
&mut self,
178177
tx: &ProgrammableTransaction,
179178
timings: &[ExecutionTiming],
@@ -320,10 +319,10 @@ impl ExecutionTimeObserver {
320319
}
321320

322321
// Share new observations.
323-
self.share_observations(to_share).await;
322+
self.share_observations(to_share);
324323
}
325324

326-
async fn share_observations(&mut self, to_share: Vec<(ExecutionTimeObservationKey, Duration)>) {
325+
fn share_observations(&mut self, to_share: Vec<(ExecutionTimeObservationKey, Duration)>) {
327326
if to_share.is_empty() {
328327
return;
329328
}
@@ -670,9 +669,7 @@ mod tests {
670669
// Record an observation
671670
let timings = vec![ExecutionTiming::Success(Duration::from_millis(100))];
672671
let total_duration = Duration::from_millis(110);
673-
observer
674-
.record_local_observations(&ptb, &timings, total_duration)
675-
.await;
672+
observer.record_local_observations(&ptb, &timings, total_duration);
676673

677674
let key = ExecutionTimeObservationKey::MoveEntryPoint {
678675
package,
@@ -693,9 +690,7 @@ mod tests {
693690
// Record another observation
694691
let timings = vec![ExecutionTiming::Success(Duration::from_millis(110))];
695692
let total_duration = Duration::from_millis(120);
696-
observer
697-
.record_local_observations(&ptb, &timings, total_duration)
698-
.await;
693+
observer.record_local_observations(&ptb, &timings, total_duration);
699694

700695
// Check that moving average was updated
701696
let local_obs = observer.local_observations.get(&key).unwrap();
@@ -710,9 +705,7 @@ mod tests {
710705
// Record another observation
711706
let timings = vec![ExecutionTiming::Success(Duration::from_millis(120))];
712707
let total_duration = Duration::from_millis(130);
713-
observer
714-
.record_local_observations(&ptb, &timings, total_duration)
715-
.await;
708+
observer.record_local_observations(&ptb, &timings, total_duration);
716709

717710
// Check that moving average was updated
718711
let local_obs = observer.local_observations.get(&key).unwrap();
@@ -738,9 +731,7 @@ mod tests {
738731
// Record last observation
739732
let timings = vec![ExecutionTiming::Success(Duration::from_millis(120))];
740733
let total_duration = Duration::from_millis(120);
741-
observer
742-
.record_local_observations(&ptb, &timings, total_duration)
743-
.await;
734+
observer.record_local_observations(&ptb, &timings, total_duration);
744735

745736
// Verify that moving average is the same and a new observation was shared, as
746737
// enough time has now elapsed
@@ -818,9 +809,7 @@ mod tests {
818809
ExecutionTiming::Success(Duration::from_millis(50)),
819810
];
820811
let total_duration = Duration::from_millis(180);
821-
observer
822-
.record_local_observations(&ptb, &timings, total_duration)
823-
.await;
812+
observer.record_local_observations(&ptb, &timings, total_duration);
824813

825814
// Check that both commands were recorded
826815
let move_key = ExecutionTimeObservationKey::MoveEntryPoint {
@@ -917,9 +906,7 @@ mod tests {
917906

918907
// First observation - should not share due to low utilization
919908
let timings = vec![ExecutionTiming::Success(Duration::from_secs(1))];
920-
observer
921-
.record_local_observations(&ptb, &timings, Duration::from_secs(2))
922-
.await;
909+
observer.record_local_observations(&ptb, &timings, Duration::from_secs(2));
923910
assert!(observer
924911
.local_observations
925912
.get(&key)
@@ -929,9 +916,7 @@ mod tests {
929916

930917
// Second observation - no time has passed, so now utilization is high; should share
931918
let timings = vec![ExecutionTiming::Success(Duration::from_secs(1))];
932-
observer
933-
.record_local_observations(&ptb, &timings, Duration::from_secs(2))
934-
.await;
919+
observer.record_local_observations(&ptb, &timings, Duration::from_secs(2));
935920
assert_eq!(
936921
observer
937922
.local_observations
@@ -947,9 +932,7 @@ mod tests {
947932
// when accounting for the new observation; should share
948933
tokio::time::advance(Duration::from_secs(5)).await;
949934
let timings = vec![ExecutionTiming::Success(Duration::from_secs(3))];
950-
observer
951-
.record_local_observations(&ptb, &timings, Duration::from_secs(5))
952-
.await;
935+
observer.record_local_observations(&ptb, &timings, Duration::from_secs(5));
953936
assert_eq!(
954937
observer
955938
.local_observations
@@ -964,9 +947,7 @@ mod tests {
964947
// Fourth execution after utilization drops - should not share, even though diff still high
965948
tokio::time::advance(Duration::from_secs(60)).await;
966949
let timings = vec![ExecutionTiming::Success(Duration::from_secs(11))];
967-
observer
968-
.record_local_observations(&ptb, &timings, Duration::from_secs(11))
969-
.await;
950+
observer.record_local_observations(&ptb, &timings, Duration::from_secs(11));
970951
assert_eq!(
971952
observer
972953
.local_observations

crates/sui-core/src/epoch/epoch_metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub struct EpochMetrics {
114114
/// The number of cached indebted objects in the execution time observer.
115115
pub epoch_execution_time_observer_indebted_objects: IntGauge,
116116

117-
/// The number of objects tracked by the object utilization cache.
117+
/// The number of objects tracked by the object utilieation cache.
118118
pub epoch_execution_time_observer_utilization_cache_size: IntGauge,
119119

120120
/// The number of objects determined by the execution time observer to be overutilized.

0 commit comments

Comments
 (0)