fix: t-005 a t-0029 correctif
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user