mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
routing: a slow route is not a down relay, and the relay takes whole days
A request to the TREK Valhalla that runs out its deadline (a long bike route) is answered 504 and no longer rests the relay for every user or a tab for ten minutes; that one day goes to OSRM. Only an unreachable host or a server error rests it. A day goes to the relay with up to twenty stops per request and no pause between pieces; a request that ends up at the public FOSSGIS Valhalla is cut to ten and paced, as before. The 1.1 s spacing of the server applies to the public hosts only, not to an admin's own OSRM or Valhalla. The relay keeps its connections open and asks for maneuvers only, which the relay contract now accepts.
This commit is contained in:
@@ -30,6 +30,9 @@ describe('valhallaRouteRequestSchema', () => {
|
||||
it('takes the route the planner asks for, its costing options included', () => {
|
||||
expect(valhallaRouteRequestSchema.parse(route)).toEqual(route);
|
||||
expect(valhallaRouteRequestSchema.parse({ ...route, alternates: 3 }).alternates).toBe(3);
|
||||
expect(valhallaRouteRequestSchema.parse({ ...route, directions_type: 'maneuvers' }).directions_type).toBe(
|
||||
'maneuvers',
|
||||
);
|
||||
const bike = {
|
||||
...route,
|
||||
costing: 'bicycle',
|
||||
@@ -45,6 +48,8 @@ describe('valhallaRouteRequestSchema', () => {
|
||||
const many = Array.from({ length: VALHALLA_RELAY_MAX_LOCATIONS + 1 }, () => route.locations[0]);
|
||||
expect(valhallaRouteRequestSchema.safeParse({ ...route, locations: many }).success).toBe(false);
|
||||
expect(valhallaRouteRequestSchema.safeParse({ ...route, costing: 'truck' }).success).toBe(false);
|
||||
// Only the maneuvers: `none` would drop the ferry boarding the planner reads off them.
|
||||
expect(valhallaRouteRequestSchema.safeParse({ ...route, directions_type: 'none' }).success).toBe(false);
|
||||
const off = [{ lat: 91, lon: 0 }, route.locations[1]];
|
||||
expect(valhallaRouteRequestSchema.safeParse({ ...route, locations: off }).success).toBe(false);
|
||||
});
|
||||
|
||||
@@ -66,6 +66,8 @@ export const valhallaRouteRequestSchema = z
|
||||
costing: costingSchema,
|
||||
costing_options: costingOptionsSchema.optional(),
|
||||
directions_options: z.object({ units: z.enum(['kilometers', 'miles']).optional() }).optional(),
|
||||
// The maneuvers without their narrative: TREK reads where a route boards a ferry, never the instructions.
|
||||
directions_type: z.enum(['maneuvers']).optional(),
|
||||
alternates: z.number().int().min(0).max(VALHALLA_RELAY_MAX_ALTERNATES).optional(),
|
||||
})
|
||||
.refine(withinRelayBytes.check, withinRelayBytes.message);
|
||||
|
||||
Reference in New Issue
Block a user