Skip to content

Commit

Permalink
chore: apply suggestions from CR
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Dec 27, 2023
1 parent eb77efe commit b68a8ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/datanode/src/heartbeat/task_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,13 @@ mod tests {
async fn test_async_task_tracker_wait_timeout() {
let tracker = TaskTracker::<TestResult>::new();
let region_id = RegionId::new(1024, 1);
let (tx, rx) = oneshot::channel::<()>();

let result = tracker
.try_register(
region_id,
Box::pin(async move {
tokio::time::sleep(Duration::from_millis(200)).await;
let _ = rx.await;
Ok(TestResult { value: 1024 })
}),
)
Expand All @@ -264,7 +265,8 @@ mod tests {
let result = tracker.wait(&mut watcher, Duration::from_millis(100)).await;
assert!(result.is_timeout());

tokio::time::sleep(Duration::from_millis(150)).await;
// Triggers first future return.
tx.send(()).unwrap();
let result = tracker
.wait(&mut watcher, Duration::from_millis(100))
.await
Expand Down

0 comments on commit b68a8ac

Please sign in to comment.