Skip to content

Commit

Permalink
chore: log when reserve failed in test
Browse files Browse the repository at this point in the history
  • Loading branch information
fengys1996 committed Dec 23, 2024
1 parent 9b2b20d commit e02bc35
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use shm_ringbuf::{
producer::{prealloc::PreAlloc, RingbufProducer},
};
use tokio::{sync::mpsc::Sender, time::sleep};
use tracing::{error, warn};

pub struct MsgForward {
pub sender: Sender<String>,
Expand Down Expand Up @@ -74,8 +75,12 @@ pub async fn reserve_with_retry(
};

if !matches!(err, shm_ringbuf::error::Error::NotEnoughSpace { .. }) {
error!("reserve failed, retry: {}, error: {:?}, break", size, err);
break;
}

warn!("reserve failed, retry: {}, error: {:?}, retry", size, err);

sleep(retry_interval).await;
}

Expand Down

0 comments on commit e02bc35

Please sign in to comment.