From c1ad275e71bf3bf589b6a02b8e1c40094fbe7acb Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Wed, 16 Aug 2017 11:53:21 -0700 Subject: [PATCH] Empty CSV entries (nodeA,nodeA) can be treated as non-fatal as long as we don't try to update any matching artificial segments. --- src/updater/csv_source.cpp | 4 ++-- src/updater/updater.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/updater/csv_source.cpp b/src/updater/csv_source.cpp index e0fa163c6..c00596f56 100644 --- a/src/updater/csv_source.cpp +++ b/src/updater/csv_source.cpp @@ -44,8 +44,8 @@ SegmentLookupTable readSegmentValues(const std::vector &paths) }); if (found_inconsistency != std::end(result.lookup)) { - throw util::exception("empty segment in CSV with node " + - std::to_string(found_inconsistency->first.from) + " " + SOURCE_REF); + util::Log(logWARNING) << "Empty segment in CSV with node " + + std::to_string(found_inconsistency->first.from); } return result; diff --git a/src/updater/updater.cpp b/src/updater/updater.cpp index 27645d7f1..569cf3098 100644 --- a/src/updater/updater.cpp +++ b/src/updater/updater.cpp @@ -221,6 +221,12 @@ updateSegmentData(const UpdaterConfig &config, { auto u = osm_node_ids[nodes_range[segment_offset]]; auto v = osm_node_ids[nodes_range[segment_offset + 1]]; + + // Self-loops are artifical segments (e.g. traffic light nodes), do not + // waste time updating them with traffic data + if (u == v) + continue; + if (auto value = segment_speed_lookup({u, v})) { auto segment_length = segment_lengths[segment_offset]; @@ -254,6 +260,12 @@ updateSegmentData(const UpdaterConfig &config, { auto u = osm_node_ids[nodes_range[segment_offset]]; auto v = osm_node_ids[nodes_range[segment_offset + 1]]; + + // Self-loops are artifical segments (e.g. traffic light nodes), do not + // waste time updating them with traffic data + if (u == v) + continue; + if (auto value = segment_speed_lookup({v, u})) { auto segment_length = segment_lengths[segment_offset];