mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-05 19:14:43 +00:00
merged_tree: extract polling of tree futures into a function
This commit is contained in:
parent
c77417d4e4
commit
1140295829
1 changed files with 10 additions and 6 deletions
|
@ -1170,13 +1170,8 @@ impl<'matcher> TreeDiffStreamImpl<'matcher> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl Stream for TreeDiffStreamImpl<'_> {
|
fn poll_tree_futures(&mut self, cx: &mut Context<'_>) {
|
||||||
type Item = (RepoPath, BackendResult<(MergedTreeValue, MergedTreeValue)>);
|
|
||||||
|
|
||||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
|
||||||
// Go through all pending tree futures and poll them.
|
|
||||||
let mut pending_index = 0;
|
let mut pending_index = 0;
|
||||||
while pending_index < self.pending_trees.len()
|
while pending_index < self.pending_trees.len()
|
||||||
&& (pending_index < self.max_concurrent_reads
|
&& (pending_index < self.max_concurrent_reads
|
||||||
|
@ -1205,6 +1200,15 @@ impl Stream for TreeDiffStreamImpl<'_> {
|
||||||
pending_index += 1;
|
pending_index += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Stream for TreeDiffStreamImpl<'_> {
|
||||||
|
type Item = (RepoPath, BackendResult<(MergedTreeValue, MergedTreeValue)>);
|
||||||
|
|
||||||
|
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||||
|
// Go through all pending tree futures and poll them.
|
||||||
|
self.poll_tree_futures(cx);
|
||||||
|
|
||||||
// Now emit the first file, or the first tree that completed with an error
|
// Now emit the first file, or the first tree that completed with an error
|
||||||
if let Some(entry) = self.items.first_entry() {
|
if let Some(entry) = self.items.first_entry() {
|
||||||
|
|
Loading…
Reference in a new issue