Skip to content

Commit cc9ffd4

Browse files
committed
fix replicator bug
1 parent cc45d05 commit cc9ffd4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libsql-wal/src/replication/replicator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,20 @@ impl<IO: Io> Replicator<IO> {
4040
///
4141
/// In a single replication step, the replicator guarantees that a minimal set of frames is
4242
/// sent to the replica.
43-
pub fn frame_stream(&mut self) -> impl Stream<Item = Result<Box<Frame>>> + '_ {
43+
pub fn into_frame_stream(mut self) -> impl Stream<Item = Result<Box<Frame>>> + Send {
4444
async_stream::try_stream! {
4545
loop {
4646
// First we decide up to what frame_no we want to replicate in this step. If we are
4747
// already up to date, wait for something to happen
4848
let most_recent_frame_no = *self
4949
.new_frame_notifier
50-
.wait_for(|fno| *fno > self.next_frame_no)
50+
.wait_for(|fno| *fno >= self.next_frame_no)
5151
.await
5252
.expect("channel cannot be closed because we hold a ref to the sending end");
5353

5454
let mut commit_frame_no = 0;
5555
// we have stuff to replicate
56-
if most_recent_frame_no > self.next_frame_no {
56+
if most_recent_frame_no >= self.next_frame_no {
5757
// first replicate the most recent version of each page from the current
5858
// segment. We also return how far we have replicated from the current log
5959
let current = self.shared.current.load();

0 commit comments

Comments
 (0)