Skip to content

Commit 66bc273

Browse files
Set default timeout to 5 seconds again
1 parent 572b714 commit 66bc273

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

application/src/main/java/org/opentripplanner/routing/api/request/preference/StreetPreferences.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.opentripplanner.street.model.StreetMode;
1313
import org.opentripplanner.street.search.intersection_model.DrivingDirection;
1414
import org.opentripplanner.street.search.intersection_model.IntersectionTraversalModel;
15+
import org.opentripplanner.street.search.request.StreetSearchRequest;
1516
import org.opentripplanner.utils.lang.DoubleUtils;
1617
import org.opentripplanner.utils.lang.Units;
1718
import org.opentripplanner.utils.tostring.ToStringBuilder;
@@ -42,7 +43,7 @@ private StreetPreferences() {
4243
this.accessEgress = AccessEgressPreferences.DEFAULT;
4344
this.intersectionTraversalModel = IntersectionTraversalModel.SIMPLE;
4445
this.maxDirectDuration = durationForStreetModeOf(ofHours(4));
45-
this.routingTimeout = Duration.ofSeconds(5);
46+
this.routingTimeout = StreetSearchRequest.DEFAULT.timeout();
4647
}
4748

4849
private StreetPreferences(Builder builder) {

street/src/main/java/org/opentripplanner/street/search/request/StreetSearchRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
public class StreetSearchRequest implements AStarRequest {
2626

27-
private static final StreetSearchRequest DEFAULT = new StreetSearchRequest();
27+
public static final StreetSearchRequest DEFAULT = new StreetSearchRequest();
2828

2929
/**
3030
* How close to do you have to be to the start or end to be considered "close".
@@ -80,7 +80,7 @@ private StreetSearchRequest() {
8080
this.rentalPeriod = null;
8181
this.intersectionTraversalCalculator = IntersectionTraversalCalculator.DEFAULT;
8282
this.extensionRequestContexts = List.of();
83-
this.timeout = Duration.ofSeconds(30);
83+
this.timeout = Duration.ofSeconds(5);
8484
}
8585

8686
StreetSearchRequest(StreetSearchRequestBuilder builder) {

street/src/test/java/org/opentripplanner/street/search/request/StreetSearchRequestBuilderTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.opentripplanner.street.search.request;
22

3+
import static org.junit.jupiter.api.Assertions.assertEquals;
34
import static org.junit.jupiter.api.Assertions.assertFalse;
45
import static org.junit.jupiter.api.Assertions.assertTrue;
56
import static org.opentripplanner.street.search.TraverseMode.BICYCLE;
67
import static org.opentripplanner.street.search.TraverseMode.CAR;
78
import static org.opentripplanner.street.search.TraverseMode.SCOOTER;
89

10+
import java.time.Duration;
911
import java.util.List;
1012
import org.junit.jupiter.api.Test;
1113
import org.opentripplanner.street.search.TraverseMode;
@@ -26,4 +28,10 @@ void withUseRentalAvailability() {
2628
)
2729
);
2830
}
31+
32+
@Test
33+
void defaultTimeout() {
34+
var orig = StreetSearchRequest.of().build();
35+
assertEquals(Duration.ofSeconds(5), orig.timeout());
36+
}
2937
}

0 commit comments

Comments
 (0)