From 4007fb8790e261a53e479fb7dc83762e632b745e Mon Sep 17 00:00:00 2001 From: Douglas Barone Date: Tue, 8 Feb 2022 08:57:36 -0400 Subject: [PATCH] Add request timeout --- server/src/lib/paloalto.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/lib/paloalto.js b/server/src/lib/paloalto.js index 4fbc9a4..6d8c434 100644 --- a/server/src/lib/paloalto.js +++ b/server/src/lib/paloalto.js @@ -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 })