fix: t-005 a t-0029 correctif

This commit is contained in:
2026-03-18 09:00:11 +01:00
parent bdb65a09ff
commit c12387ac94
16 changed files with 45 additions and 59 deletions

View File

@@ -1,12 +1,18 @@
import targets from "../config/version-status-targets.json"
const REQUEST_TIMEOUT_MS = 5000
export default defineEventHandler(async () => {
const results = await Promise.all(
targets.map(async (target) => {
const controller = new AbortController()
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS)
try {
const response = await fetch(target.url, {
method: "GET",
headers: { Accept: "application/json" }
headers: { Accept: "application/json" },
signal: controller.signal
})
return {
@@ -25,6 +31,8 @@ export default defineEventHandler(async () => {
checkedAt: new Date().toISOString(),
error: error instanceof Error ? error.message : String(error)
}
} finally {
clearTimeout(timeoutId)
}
})
)