From 14304c9c1d1ee01c6e7b3834deb2b1cc8a8ec740 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 22 Jul 2021 22:22:22 +0100 Subject: Only update position after event handler --- lib/input/replStream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/input') diff --git a/lib/input/replStream.cpp b/lib/input/replStream.cpp index 7a995d3..f7452e7 100644 --- a/lib/input/replStream.cpp +++ b/lib/input/replStream.cpp @@ -32,10 +32,11 @@ namespace MyGrate::Input { verify(!mariadb_rpl_open(rpl.get()), "Failed to mariadb_rpl_open", this); while (MyGrate::MariaDB_Event_Ptr event {mariadb_rpl_fetch(rpl.get(), nullptr), &mariadb_free_rpl_event}) { - position = event->next_event_pos; + auto np = event->next_event_pos; if (const auto & h = eventHandlers.at(event->event_type); h.func) { (eh.*h.func)(std::move(event)); } + position = np; } } -- cgit v1.2.3