Skip to content

Commit

Permalink
Merge pull request #1886 from tursodatabase/cleanup
Browse files Browse the repository at this point in the history
Small code refactoring
  • Loading branch information
haaawk authored Dec 23, 2024
2 parents 58b016a + dfd557d commit e10af22
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libsql-server/src/replication/primary/replication_logger_wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ impl ReplicationLoggerWalWrapper {

/// write buffered pages to the logger, without committing.
fn flush(&mut self, size_after: u32) -> anyhow::Result<()> {
if !self.buffer.is_empty() {
self.buffer.last_mut().unwrap().size_after = size_after;
self.logger.write_pages(&self.buffer)?;
self.buffer.clear();
}
let Some(last_page) = self.buffer.last_mut() else {
return Ok(());
};
last_page.size_after = size_after;
self.logger.write_pages(&self.buffer)?;
self.buffer.clear();

Ok(())
}
Expand Down

0 comments on commit e10af22

Please sign in to comment.