Skip to content

Commit 67d3a71

Browse files
committed
Fix iteration condition for end_pos
* Binlog event at end_pos is the last event to be read. (end_pos is inclusive) * iter() ends when fetch_one() returns None.
1 parent c0bf419 commit 67d3a71

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pymysqlreplication/binlogstream.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ def __connect_to_stream(self):
419419
self.__connected_stream = True
420420

421421
def fetchone(self):
422-
should_continue = True
423-
while should_continue:
422+
while True:
424423
if not self.__connected_stream:
425424
self.__connect_to_stream()
426425

@@ -474,9 +473,9 @@ def fetchone(self):
474473
elif binlog_event.log_pos:
475474
self.log_pos = binlog_event.log_pos
476475

477-
if self.end_log_pos and self.log_pos >= self.end_log_pos:
476+
if self.end_log_pos and self.log_pos > self.end_log_pos:
478477
# We're currently at, or past, the specified end log position.
479-
should_continue = False
478+
return None
480479

481480
# This check must not occur before clearing the ``table_map`` as a
482481
# result of a RotateEvent.

0 commit comments

Comments
 (0)