diff --git a/nonfree/controller/CentralDB.cpp b/nonfree/controller/CentralDB.cpp index 46349c734..04ee52f44 100644 --- a/nonfree/controller/CentralDB.cpp +++ b/nonfree/controller/CentralDB.cpp @@ -1442,6 +1442,10 @@ void CentralDB::onlineNotificationThread() std::string memberId(memTmp); try { + // check if the member exists first. + // + // exec_params1 will throw pqxx::unexpected_rows if not exactly one row is returned. If that's the + // case, skip this record and move on. pqxx::row r = w.exec_params1( "SELECT device_id, network_id FROM network_memberships_ctl WHERE network_id = $1 AND device_id " "= $2", diff --git a/nonfree/controller/PostgresStatusWriter.cpp b/nonfree/controller/PostgresStatusWriter.cpp index 5e59e73f5..e16fb038e 100644 --- a/nonfree/controller/PostgresStatusWriter.cpp +++ b/nonfree/controller/PostgresStatusWriter.cpp @@ -57,20 +57,6 @@ void PostgresStatusWriter::writePending() { entry.address.toIpString(iptmp), entry.last_seen }, }; - try { - // check if the member exists first. - // - // exec_params1 will throw pqxx::unexpected_rows if not exactly one row is returned. If that's the - // case, skip this record and move on. - w.exec_params1( - "SELECT device_id, network_id FROM network_memberships_ctl WHERE network_id = $1 AND device_id = " - "$2", - entry.network_id, entry.node_id); - } - catch (pqxx::unexpected_rows& e) { - continue; - } - std::string insert_statement = "INSERT INTO network_memberships_ctl (device_id, network_id, last_seen, os, arch) " "VALUES ('"