Skip to content

Commit

Permalink
Merge pull request #461 from mmd-osm/patch/upload1
Browse files Browse the repository at this point in the history
Diff upload: minor improvements
  • Loading branch information
mmd-osm authored Jan 4, 2025
2 parents e6512df + f55233f commit 5b16795
Show file tree
Hide file tree
Showing 11 changed files with 403 additions and 316 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ApiDB_Node_Updater : public api06::Node_Updater {
std::vector<node_t> modify_nodes;
std::vector<node_t> delete_nodes;

std::set<osm_nwr_signed_id_t> create_placedholder_ids;
std::set<osm_nwr_signed_id_t> create_placeholder_ids;
};

#endif /* APIDB_NODE_UPDATER */
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class ApiDB_Relation_Updater : public api06::Relation_Updater {
std::vector<relation_t> modify_relations;
std::vector<relation_t> delete_relations;

std::set<osm_nwr_signed_id_t> create_placedholder_ids;
std::set<osm_nwr_signed_id_t> create_placeholder_ids;
};

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ApiDB_Way_Updater : public api06::Way_Updater {
std::vector<way_t> modify_ways;
std::vector<way_t> delete_ways;

std::set<osm_nwr_signed_id_t> create_placedholder_ids;
std::set<osm_nwr_signed_id_t> create_placeholder_ids;
};

#endif /* APIDB_WAY_UPDATER */
11 changes: 10 additions & 1 deletion include/cgimap/backend/apidb/transaction_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,16 @@ class Transaction_Manager {

pqxx::result exec(const std::string &query,
const std::string &description = std::string());
void commit();

void commit() {
const auto start = std::chrono::steady_clock::now();
m_txn.commit();
const auto end = std::chrono::steady_clock::now();

const auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);

logger::message(fmt::format("COMMIT transaction in {:d} ms", elapsed.count()));
}

template<typename... Args>
[[nodiscard]] pqxx::result exec_prepared(const std::string &statement, Args&&... args) {
Expand Down
2 changes: 1 addition & 1 deletion include/cgimap/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ inline std::string escape(std::string_view input) {
}

template <typename T>
inline std::string to_string(const std::set<T> &ids) {
inline std::string to_string(const T &ids) {
return fmt::format("{}", fmt::join(ids, ","));
}

Expand Down
Loading

0 comments on commit 5b16795

Please sign in to comment.