extend more info timeout to 30s

This commit is contained in:
TheFozid 2026-08-03 14:47:33 +01:00
parent 195c84106e
commit fff8a8382b
3 changed files with 12 additions and 10 deletions

2
Cargo.lock generated
View file

@ -1590,7 +1590,7 @@ dependencies = [
[[package]]
name = "rs_maps"
version = "0.3.2"
version = "0.3.3"
dependencies = [
"anyhow",
"argon2",

View file

@ -1,7 +1,7 @@
# Cargo.toml
[package]
name = "rs_maps"
version = "0.3.2"
version = "0.3.3"
edition = "2021"
[dependencies]

View file

@ -36,9 +36,10 @@ const OVERPASS_ENDPOINTS = [
'https://overpass.private.coffee/api/interpreter',
];
// Past this, move on to the next mirror. A single-object lookup that hasn't
// answered in 8s isn't going to.
const OVERPASS_TIMEOUT_MS = 8000;
// Overpass queues requests when busy — a trivial single-object lookup has been
// observed taking over a minute before returning a perfectly good 200. 30s is
// the most that's reasonable to make someone wait; past that, give up quietly.
const OVERPASS_TIMEOUT_MS = 30000;
const COLOURS = ['#4E9C6B', '#D2467F', '#E2A93C', '#4E8FC9', '#B07BD4', '#D3574B'];
const DEFAULT_COLOUR = COLOURS[0];
@ -705,7 +706,9 @@ async function fetchOsmTags(osmType, osmId) {
const short = OSM_SHORT[osmType];
if (!short) return null;
const query = `[out:json][timeout:10];${short}(${osmId});out tags;`;
// Server-side budget matched to ours, so it sheds the request rather than
// holding it in a queue we've already stopped waiting on.
const query = `[out:json][timeout:30];${short}(${osmId});out tags;`;
let lastError = null;
for (const endpoint of OVERPASS_ENDPOINTS) {
@ -907,12 +910,11 @@ function showSearchHit(hit) {
slot.replaceChildren(node);
more.remove();
} catch {
// Overpass being busy is routine and not worth interrupting anyone
// over. The button simply comes back so it can be pressed again;
// the reason stays in the console.
more.disabled = false;
more.textContent = 'More details';
// Every mirror was busy or unreachable. This is a load problem at
// their end, not missing data — worth saying so, since retrying in a
// minute usually works.
toast('OpenStreetMap details are busy — try again shortly', true);
}
popup.update(); // re-measure after the content grew
});