Add request timeout

This commit is contained in:
Douglas Barone 2022-02-08 08:57:36 -04:00
parent e81765c235
commit 4007fb8790

View File

@ -13,8 +13,8 @@ import { performance } from 'perf_hooks'
import prisma from '../prisma'
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 REQUEST_TIMEOUT_IN_MS = 20000
const httpsAgent = new https.Agent({
rejectUnauthorized: false
@ -97,7 +97,7 @@ async function updateUserIdMappings() {
params: { type: 'user-id', key: decryptKey(pAHost.encryptedKey) },
data: qs.stringify({ cmd }),
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
timeout: REQUEST_TIMEOUT_IN_MS,
httpsAgent
})