Skip to content

Commit 2158980

Browse files
committed
resolve AI comments
1 parent 10241f8 commit 2158980

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/ipld/util.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use fvm_ipld_blockstore::Blockstore;
1616
use parking_lot::Mutex;
1717
use pin_project_lite::pin_project;
1818
use std::borrow::Borrow;
19+
use std::fmt::Display;
1920
use std::ops::DerefMut;
2021
use std::pin::Pin;
2122
use std::task::{Context, Poll};
@@ -458,11 +459,13 @@ impl<'a, DB: Blockstore + Send + Sync + 'static, T: Iterator<Item = Tipset> + Un
458459
type Item = anyhow::Result<CarBlock>;
459460

460461
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
461-
fn send<T>(sender: &Option<flume::Sender<T>>, v: T) -> Result<(), flume::SendError<T>> {
462+
fn send<T: Display>(sender: &Option<flume::Sender<T>>, v: T) -> anyhow::Result<()> {
462463
if let Some(sender) = sender {
463-
sender.send(v)
464+
sender
465+
.send(v)
466+
.map_err(|e| anyhow::anyhow!("failed to send {}", e.into_inner()))
464467
} else {
465-
Err(flume::SendError(v))
468+
anyhow::bail!("attempted to enqueue after shutdown (extract_sender dropped): {v}");
466469
}
467470
}
468471

@@ -553,7 +556,7 @@ impl<'a, DB: Blockstore + Send + Sync + 'static, T: Iterator<Item = Tipset> + Un
553556
} else if let Some(extract_sender) = this.extract_sender
554557
&& extract_sender.is_empty()
555558
{
556-
// drop the sender to abort the woker task
559+
// drop the sender to abort the worker task
557560
*this.extract_sender = None;
558561
}
559562
}

0 commit comments

Comments
 (0)