Skip to content

Commit

Permalink
Don't drop only partially supported GTFS-RT messages
Browse files Browse the repository at this point in the history
Previously all messages containing unsupported fields like (alert or
vehicle) were ignored, even if they contained an understandable
trip_update.

This commit also changes the debug output to show the names of the
relevant fields to make it easier to debug GTFS-RT feeds without looking
at the MOTIS source code.
  • Loading branch information
jbruechert committed Dec 11, 2024
1 parent 2cf648a commit 86269c1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/rt/gtfsrt_update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,33 +270,33 @@ statistics gtfsrt_update_msg(timetable const& tt,
for (auto const& entity : msg.entity()) {
if (entity.has_is_deleted() && entity.is_deleted()) {
log(log_lvl::error, "rt.gtfs.unsupported",
"unsupported deleted (tag={}, id={})", tag, entity.id());
R"(unsupported "id_deleted" field (tag={}, id={}), skipping message)", tag, entity.id());
++stats.unsupported_deleted_;
continue;
} else if (entity.has_alert()) {
log(log_lvl::error, "rt.gtfs.unsupported",
"unsupported alert (tag={}, id={})", tag, entity.id());
R"(ignoring unsupported "alert" field (tag={}, id={}))", tag, entity.id());
++stats.unsupported_alert_;
continue;
// no continue here so we don't skip as long as it also has a trip_update
} else if (entity.has_vehicle()) {
log(log_lvl::error, "rt.gtfs.unsupported",
"unsupported vehicle (tag={}, id={})", tag, entity.id());
R"(ignoring unsupported "vehicle" field (tag={}, id={}))", tag, entity.id());
++stats.unsupported_vehicle_;
continue;
// no continue here so we don't skip as long as it also has a trip_update
} else if (!entity.has_trip_update()) {
log(log_lvl::error, "rt.gtfs.unsupported",
"unsupported no trip update (tag={}, id={})", tag, entity.id());
R"(unsupported: no "trip_update" field (tag={}, id={}), skipping message)", tag, entity.id());
++stats.no_trip_update_;
continue;
} else if (!entity.trip_update().has_trip()) {
log(log_lvl::error, "rt.gtfs.unsupported",
"unsupported no trip in trip update (tag={}, id={})", tag,
R"(unsupported: no "trip" field in "trip_update" field (tag={}, id={}), skipping message)", tag,
entity.id());
++stats.trip_update_without_trip_;
continue;
} else if (!entity.trip_update().trip().has_trip_id()) {
log(log_lvl::error, "rt.gtfs.unsupported",
"unsupported trip without trip_id (tag={}, id={})", tag, entity.id());
R"(unsupported: no "trip_id" field in "trip_update.trip" (tag={}, id={}), skipping message)", tag, entity.id());
++stats.unsupported_no_trip_id_;
continue;
} else if (entity.trip_update().trip().schedule_relationship() !=
Expand Down

0 comments on commit 86269c1

Please sign in to comment.