Merged in feat/sw-3006-timeout-fetch (pull request #2335)
feat(SW-3006): added default timeout to all requests * feat(sw-3006): added default timeout to all requests * Fixed spreading Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -880,7 +880,9 @@ export const hotelQueryRouter = router({
|
||||
`coordinates:${address}`,
|
||||
async function () {
|
||||
const url = `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(address)}&key=${apiKey}`
|
||||
const response = await fetch(url)
|
||||
const response = await fetch(url, {
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
})
|
||||
const data = await response.json()
|
||||
|
||||
if (data.status !== "OK") {
|
||||
|
||||
@@ -32,6 +32,7 @@ export const jobylonQueryRouter = router({
|
||||
async () => {
|
||||
const response = await fetch(url, {
|
||||
cache: "no-cache",
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -110,6 +110,7 @@ async function fetchRequestOtp({ sasAuthToken }: { sasAuthToken: string }) {
|
||||
body: JSON.stringify({
|
||||
referenceId: uuidv4(),
|
||||
}),
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ async function fetchVerifyOtp(input: z.infer<typeof inputSchema>) {
|
||||
otpCode: input.otp,
|
||||
databaseUUID: databaseUUID,
|
||||
}),
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@ async function fetchServiceToken(scopes: string[]) {
|
||||
client_secret: env.CURITY_CLIENT_SECRET_SERVICE,
|
||||
scope: scopes.join(" "),
|
||||
}),
|
||||
signal: AbortSignal.timeout(15_000),
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user