The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.
TypeScript budget-trackercollaborativedockeritinerarymcp-serveroffline-firstopen-sourceopenstreetmappacking-listpwareal-timeself-hostedselfhostedtraveltravel-apptravel-journaltravel-plannertripitwanderlog
fix(map): ask Valhalla again for days drawn by OSRM only while the relay rested
Mauricebbc9c72168dd
diff --git a/client/src/components/Map/RouteCalculator.ts b/client/src/components/Map/RouteCalculator.tsindex 032dc0f32..4c35c1b6d 100644--- a/client/src/components/Map/RouteCalculator.ts+++ b/client/src/components/Map/RouteCalculator.ts@@ -317,8 +317,8 @@ async function valhallaOrOsrmDay(const plain = (await storedRoute(keys.plain)) ?? await osrmWithLegs(waypoints, keys.coords, profile, signal)cacheRoute(keys.plain, plain)const drawn = withFallbackNoted(plain, avoiding)- // A day left before Valhalla answered was never refused by it.- if (standInKey && !signal?.aborted) keepStandIn(standInKey, drawn)+ // A day left before Valhalla answered, or never put to it, was not refused by it.+ if (standInKey && asking && !signal?.aborted) keepStandIn(standInKey, drawn)return drawn}diff --git a/client/src/components/Map/valhallaDayRoute.test.ts b/client/src/components/Map/valhallaDayRoute.test.tsindex 5d00c44fa..c422565d2 100644--- a/client/src/components/Map/valhallaDayRoute.test.ts+++ b/client/src/components/Map/valhallaDayRoute.test.ts@@ -314,6 +314,21 @@ describe('the route cache keeps the engine apart', () => {});describe('the route cache while the relay rests', () => {+ it('VDAY-CACHE-006: a day drawn by OSRM while the relay rested is asked again as soon as it is back', async () => {+ let up = false;+ const traffic = listen((body) => (up ? answered(body) : HttpResponse.json({ error: 'down' }, { status: 503 })));+ await calculateRouteWithLegs(freshDay(2), { profile: 'driving' });+ const points = freshDay(3);+ expect((await calculateRouteWithLegs(points, { profile: 'driving' })).engine).toBe('osrm');+ expect(traffic.relay).toHaveLength(1);++ up = true;+ resetValhallaTurns();+ const routed = await calculateRouteWithLegs(points, { profile: 'driving' });+ expect([routed.distance, routed.engine]).toEqual([4000, 'valhalla']);+ expect(traffic.relay).toHaveLength(2);+ });+it('VDAY-CACHE-003: a day kept from Valhalla is still found while the relay rests, as it is offline', async () => {const points = freshDay(3);let up = true;