Skip to content

Commit

Permalink
Merge pull request #95 from omnimodal/tc_issue_92
Browse files Browse the repository at this point in the history
Make TripUpdate.delay optional in GTFS Realtime trip updates feed
  • Loading branch information
scrudden authored Aug 8, 2018
2 parents 0a19d51 + 0bed3ce commit ca67e75
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.slf4j.LoggerFactory;
import org.transitclock.api.data.IpcPredictionComparator;
import org.transitclock.api.utils.AgencyTimezoneCache;
import org.transitclock.config.BooleanConfigValue;
import org.transitclock.config.IntegerConfigValue;
import org.transitclock.core.holdingmethod.PredictionTimeComparator;
import org.transitclock.ipc.clients.PredictionsInterfaceFactory;
Expand Down Expand Up @@ -82,6 +83,12 @@ public class GtfsRtTripFeed {
"Number of seconds in the future to accept predictions before");
private static final int PREDICTION_MAX_FUTURE_SECS = predictionMaxFutureSecs.getValue();


private static BooleanConfigValue includeTripUpdateDelay = new BooleanConfigValue(
"transitclock.api.includeTripUpdateDelay", false,
"Whether or not to include delay in the TripUpdate message");
private static final boolean INCLUDE_TRIP_UPDATE_DELAY = includeTripUpdateDelay.getValue();


// For when creating StopTimeEvent for schedule based prediction
// 5 minutes (300 seconds)
Expand Down Expand Up @@ -156,7 +163,7 @@ private TripUpdate createTripUpdate(List<IpcPrediction> predsForTrip) {
}
}
tripUpdate.setTrip(tripDescriptor);
if (firstPred.getDelay() != null)
if (firstPred.getDelay() != null && INCLUDE_TRIP_UPDATE_DELAY)
tripUpdate.setDelay(firstPred.getDelay()); // set schedule deviation

// Add the VehicleDescriptor information
Expand Down

0 comments on commit ca67e75

Please sign in to comment.