summaryrefslogtreecommitdiff
path: root/lib/input
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-05-23 00:23:05 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-05-23 00:23:05 +0100
commita16eb14fd45ad61ce028c7c420f5487c5cdbb6b7 (patch)
tree0d44221568e890c934e98964f6c8132175df66fe /lib/input
parentAdd PQ basics (diff)
downloadmygrate-a16eb14fd45ad61ce028c7c420f5487c5cdbb6b7.tar.bz2
mygrate-a16eb14fd45ad61ce028c7c420f5487c5cdbb6b7.tar.xz
mygrate-a16eb14fd45ad61ce028c7c420f5487c5cdbb6b7.zip
Minor tidy up of replStream
Diffstat (limited to 'lib/input')
-rw-r--r--lib/input/replStream.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/input/replStream.cpp b/lib/input/replStream.cpp
index 0de91b5..2ec2a79 100644
--- a/lib/input/replStream.cpp
+++ b/lib/input/replStream.cpp
@@ -2,6 +2,7 @@
#include "mariadb_repl.h"
#include <eventHandlerBase.h>
#include <eventHandlers.h>
+#include <helpers.h>
#include <memory>
#include <stdexcept>
#include <utility>
@@ -21,16 +22,12 @@ namespace MyGrate::Input {
mariadb_rpl_optionsv(rpl.get(), MARIADB_RPL_START, 4);
mariadb_rpl_optionsv(rpl.get(), MARIADB_RPL_FLAGS, MARIADB_RPL_BINLOG_SEND_ANNOTATE_ROWS);
- if (mariadb_rpl_open(rpl.get())) {
- throw std::runtime_error("Failed to mariadb_rpl_open");
- }
+ verify<std::runtime_error>(!mariadb_rpl_open(rpl.get()), "Failed to mariadb_rpl_open");
while (MyGrate::MariaDB_Event_Ptr event {mariadb_rpl_fetch(rpl.get(), nullptr), &mariadb_free_rpl_event}) {
- const auto & h = eventHandlers.at(event->event_type);
- if (h.func) {
+ if (const auto & h = eventHandlers.at(event->event_type); h.func) {
(eh.*h.func)(std::move(event));
}
}
}
-
}