Skip to content

Commit 9adc11a

Browse files
committed
improvement(Move uptime check into TripPlannerVersion enum):
1 parent 619ec12 commit 9adc11a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/java/com/conveyal/datatools/manager/jobs/MonitorServerStatusJob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void jobLogic() {
136136
// become available.
137137
TimeTracker routerCheckTracker = new TimeTracker(20, TimeUnit.MINUTES);
138138

139-
String routerUrl = String.join("/", ipUrl, deployment.tripPlannerVersion.equals(TripPlannerVersion.OTP_2) ? "otp/actuators/health" : "otp/routers/default");
139+
String routerUrl = String.join("/", ipUrl, TripPlannerVersion.getUptimeCheckUrl(deployment.tripPlannerVersion));
140140
boolean routerIsAvailable = false;
141141
while (!routerIsAvailable) {
142142
// If the request was successful, the graph build is complete!

src/main/java/com/conveyal/datatools/manager/models/Deployment.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,18 @@ public boolean boundsAreValid () {
666666
}
667667

668668
public enum TripPlannerVersion {
669-
OTP_1, OTP_2
669+
OTP_1("otp/routers/default"),
670+
OTP_2("otp/actuators/health");
671+
672+
private final String uptimeCheckUrl;
673+
674+
TripPlannerVersion(String uptimeCheckUrl) {
675+
this.uptimeCheckUrl = uptimeCheckUrl;
676+
}
677+
678+
public static String getUptimeCheckUrl(TripPlannerVersion version) {
679+
return (version == OTP_2) ? OTP_2.uptimeCheckUrl : OTP_1.uptimeCheckUrl;
680+
}
670681
}
671682

672683
/**

0 commit comments

Comments
 (0)