Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Apr 26, 2024
1 parent d84b887 commit 66c88b4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions nexus/peer-cursor/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,18 @@ impl CursorManager {
})?;

let mut records = Vec::new();
let prev_end = cursor.position;
let mut cursor_position = cursor.position;
while cursor_position - prev_end < count {
while records.len() < count {
match cursor.stream.next().await {
Some(Ok(record)) => {
records.push(record);
cursor_position += 1;
tracing::info!("cusror position: {}", cursor_position);
}
Some(Err(err)) => return Err(err),
None => break,
}
}

cursor.position = cursor_position;
tracing::info!("Cursor {} fetched {} records", name, records.len());
cursor.position += records.len();

Ok(Records {
records,
Expand Down

0 comments on commit 66c88b4

Please sign in to comment.