Skip to content

Commit

Permalink
Fix list
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Mar 13, 2024
1 parent 5e276fd commit 8eab717
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions core/src/types/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,31 +156,32 @@ impl Stream for Lister {
// Trying to pull more tasks if there are more space.
if self.tasks.has_remaining() {
if let Some(fut) = self.fut.as_mut() {
let (lister, entry) = ready!(fut.as_mut().poll(cx));
self.lister = Some(lister);
self.fut = None;

match entry {
Ok(Some(oe)) => {
let (path, metadata) = oe.into_entry().into_parts();
if metadata.contains_metakey(self.required_metakey) {
self.tasks
.push_back(StatTask::Known(Some((path, metadata))));
} else {
let acc = self.acc.clone();
let fut = async move {
let res = acc.stat(&path, OpStat::default()).await;
(path, res.map(|rp| rp.into_metadata()))
};
self.tasks.push_back(StatTask::Stating(Box::pin(fut)));
if let Poll::Ready((lister, entry)) = fut.as_mut().poll(cx) {
self.lister = Some(lister);
self.fut = None;

match entry {
Ok(Some(oe)) => {
let (path, metadata) = oe.into_entry().into_parts();
if metadata.contains_metakey(self.required_metakey) {
self.tasks
.push_back(StatTask::Known(Some((path, metadata))));
} else {
let acc = self.acc.clone();
let fut = async move {
let res = acc.stat(&path, OpStat::default()).await;
(path, res.map(|rp| rp.into_metadata()))
};
self.tasks.push_back(StatTask::Stating(Box::pin(fut)));
}
}
Ok(None) => {
self.lister = None;
}
Err(err) => {
self.errored = true;
return Poll::Ready(Some(Err(err)));
}
}
Ok(None) => {
self.lister = None;
}
Err(err) => {
self.errored = true;
return Poll::Ready(Some(Err(err)));
}
}
} else if let Some(mut lister) = self.lister.take() {
Expand Down

0 comments on commit 8eab717

Please sign in to comment.