Add request timeout
This commit is contained in:
parent
e81765c235
commit
4007fb8790
|
@ -13,8 +13,8 @@ import { performance } from 'perf_hooks'
|
||||||
import prisma from '../prisma'
|
import prisma from '../prisma'
|
||||||
|
|
||||||
const MAP_TIMEOUT_IN_MINUTES = process.env.MAPPING_TIMEOUT || '360' // 6 horas
|
const MAP_TIMEOUT_IN_MINUTES = process.env.MAPPING_TIMEOUT || '360' // 6 horas
|
||||||
|
|
||||||
const CIDR_RE = /^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$/
|
const CIDR_RE = /^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$/
|
||||||
|
const REQUEST_TIMEOUT_IN_MS = 20000
|
||||||
|
|
||||||
const httpsAgent = new https.Agent({
|
const httpsAgent = new https.Agent({
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
|
@ -97,7 +97,7 @@ async function updateUserIdMappings() {
|
||||||
params: { type: 'user-id', key: decryptKey(pAHost.encryptedKey) },
|
params: { type: 'user-id', key: decryptKey(pAHost.encryptedKey) },
|
||||||
data: qs.stringify({ cmd }),
|
data: qs.stringify({ cmd }),
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
timeout: REQUEST_TIMEOUT_IN_MS,
|
||||||
httpsAgent
|
httpsAgent
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user