From 72dd749717ecdd4a769bed36bbfbe06dc0056772 Mon Sep 17 00:00:00 2001 From: extremeheat Date: Sat, 24 Sep 2022 15:46:33 -0400 Subject: [PATCH] tools/vanillaServer: add HEAD request timeout prevent long hangs --- tools/startVanillaServer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/startVanillaServer.js b/tools/startVanillaServer.js index be63b47..3d408c1 100644 --- a/tools/startVanillaServer.js +++ b/tools/startVanillaServer.js @@ -5,7 +5,7 @@ const debug = process.env.CI ? console.debug : require('debug')('minecraft-proto const https = require('https') const { getFiles, waitFor } = require('../src/datatypes/util') -const head = (url) => new Promise((resolve, reject) => http.request(url, { method: 'HEAD' }, resolve).on('error', reject).end()) +const head = (url) => new Promise((resolve, reject) => http.request(url, { method: 'HEAD', timeout: 500 }, resolve).on('error', reject).end()) function get (url, outPath) { const file = fs.createWriteStream(outPath) return new Promise((resolve, reject) => {