Skip to content

Commit

Permalink
fix warn
Browse files Browse the repository at this point in the history
  • Loading branch information
JackTan25 committed Jul 12, 2023
1 parent 19ab4ff commit d3bb666
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/query/service/src/api/rpc/exchange/statistics_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use crate::sessions::QueryContext;

pub struct StatisticsSender {
_spawner: Arc<QueryContext>,
shutdown_flag: Arc<AtomicBool>,
shutdown_flag_sender: Sender<Option<ErrorCode>>,
join_handle: Option<JoinHandle<()>>,
}
Expand All @@ -47,18 +46,16 @@ impl StatisticsSender {
) -> StatisticsSender {
let spawner = ctx.clone();
let tx = exchange.convert_to_sender();
let shutdown_flag = Arc::new(AtomicBool::new(false));
let (shutdown_flag_sender, shutdown_flag_receiver) = async_channel::bounded(1);

let handle = spawner.spawn({
let query_id = query_id.to_string();
let shutdown_flag = shutdown_flag.clone();

async move {
let mut sleep_future = Box::pin(sleep(Duration::from_millis(100)));
let mut notified = Box::pin(shutdown_flag_receiver.recv());

while !shutdown_flag.load(Ordering::Relaxed) {
while true {
match futures::future::select(sleep_future, notified).await {
Either::Right((Ok(None), _)) | Either::Right((Err(_), _)) => {
break;
Expand Down Expand Up @@ -94,7 +91,6 @@ impl StatisticsSender {

StatisticsSender {
_spawner: spawner,
shutdown_flag,
shutdown_flag_sender,
join_handle: Some(handle),
}
Expand Down

0 comments on commit d3bb666

Please sign in to comment.