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:
@@ -98,6 +98,20 @@ const recent = useRecentLocations()
|
||||
|
||||
const inputRef = ref<HTMLInputElement | null>(null)
|
||||
const query = ref('')
|
||||
const queryDebounced = ref('')
|
||||
let queryDebounceId: ReturnType<typeof setTimeout> | null = null
|
||||
const SEARCH_DEBOUNCE_MS = 180
|
||||
watch(
|
||||
query,
|
||||
(v) => {
|
||||
if (queryDebounceId) clearTimeout(queryDebounceId)
|
||||
queryDebounceId = setTimeout(() => {
|
||||
queryDebounced.value = v
|
||||
queryDebounceId = null
|
||||
}, SEARCH_DEBOUNCE_MS)
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
const showDropdown = ref(false)
|
||||
const highlightIndex = ref(0)
|
||||
let closeDropdownTimer: ReturnType<typeof setTimeout> | null = null
|
||||
@@ -113,7 +127,7 @@ interface Suggestion {
|
||||
}
|
||||
|
||||
const suggestions = computed<Suggestion[]>(() => {
|
||||
const q = query.value.trim().toLowerCase()
|
||||
const q = queryDebounced.value.trim().toLowerCase()
|
||||
if (!q) return []
|
||||
|
||||
const coordMatch = q.match(/^\s*(-?\d+)\s*[,;\s]\s*(-?\d+)\s*$/)
|
||||
@@ -193,10 +207,18 @@ const emit = defineEmits<{
|
||||
'jump-to-marker': [id: number]
|
||||
}>()
|
||||
|
||||
watch(suggestions, () => {
|
||||
highlightIndex.value = 0
|
||||
}, { flush: 'sync' })
|
||||
|
||||
onMounted(() => {
|
||||
useMapNavigate().setFocusSearch(() => inputRef.value?.focus())
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (queryDebounceId) clearTimeout(queryDebounceId)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (closeDropdownTimer) clearTimeout(closeDropdownTimer)
|
||||
useMapNavigate().setFocusSearch(null)
|
||||
|
||||
Reference in New Issue
Block a user