Implement HTTP timeout configurations and enhance API documentation

- Added optional HTTP server timeout configurations (`HNHMAP_READ_TIMEOUT`, `HNHMAP_WRITE_TIMEOUT`, `HNHMAP_IDLE_TIMEOUT`) to `.env.example` and updated the server initialization in `main.go` to utilize these settings.
- Enhanced API documentation for the `rebuildZooms` endpoint to clarify its background processing and polling mechanism for status updates.
- Updated `configuration.md` to include new timeout environment variables for better configuration guidance.
- Improved error handling in the client for large request bodies, ensuring appropriate responses for oversized payloads.
This commit is contained in:
2026-03-04 11:59:28 +03:00
parent a3a4c0e896
commit dda35baeca
17 changed files with 396 additions and 73 deletions

View File

@@ -283,6 +283,7 @@ function updateSelectedMarkerForBookmark() {
}
}
let intervalId: ReturnType<typeof setInterval> | null = null
let characterPollFirstTickId: ReturnType<typeof setTimeout> | null = null
let autoMode = false
let mapContainer: HTMLElement | null = null
let contextMenuHandler: ((ev: MouseEvent) => void) | null = null
@@ -554,13 +555,20 @@ onMounted(async () => {
}
function startCharacterPoll() {
if (characterPollFirstTickId) clearTimeout(characterPollFirstTickId)
characterPollFirstTickId = null
if (intervalId) clearInterval(intervalId)
intervalId = null
const ms =
typeof document !== 'undefined' && document.visibilityState === 'hidden'
? CHARACTER_POLL_MS_HIDDEN
: CHARACTER_POLL_MS
pollCharacters()
intervalId = setInterval(pollCharacters, ms)
// First tick after delay to avoid double-fetch with initial getCharacters() in Promise.all
characterPollFirstTickId = setTimeout(() => {
characterPollFirstTickId = null
pollCharacters()
intervalId = setInterval(pollCharacters, ms)
}, ms)
}
startCharacterPoll()
@@ -703,6 +711,7 @@ onBeforeUnmount(() => {
if (contextMenuHandler) {
document.removeEventListener('contextmenu', contextMenuHandler, true)
}
if (characterPollFirstTickId) clearTimeout(characterPollFirstTickId)
if (intervalId) clearInterval(intervalId)
updatesHandle?.cleanup()
if (leafletMap) leafletMap.remove()