mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-30 23:12:53 +03:00
Avoid hanging waiting for operations when buffer has none
This commit is contained in:
parent
75803d8dbb
commit
344d05045d
@ -6255,16 +6255,19 @@ fn split_operations(
|
||||
#[cfg(not(any(test, feature = "test-support")))]
|
||||
const CHUNK_SIZE: usize = 100;
|
||||
|
||||
let mut done = false;
|
||||
std::iter::from_fn(move || {
|
||||
if operations.is_empty() {
|
||||
if done {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(
|
||||
operations
|
||||
let operations = operations
|
||||
.drain(..cmp::min(CHUNK_SIZE, operations.len()))
|
||||
.collect(),
|
||||
)
|
||||
.collect::<Vec<_>>();
|
||||
if operations.is_empty() {
|
||||
done = true;
|
||||
}
|
||||
Some(operations)
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user