From 36d47d3d0cacc2330faa0623a90050abb952e698 Mon Sep 17 00:00:00 2001 From: amuliang <982632988@qq.com> Date: Sun, 18 Feb 2024 20:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=AD=89=E5=BE=85=E6=97=B6?= =?UTF-8?q?=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/StoreModel.js | 10 +++++++--- html/index.html | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/model/StoreModel.js b/app/model/StoreModel.js index 6f654bb..8d62bf0 100644 --- a/app/model/StoreModel.js +++ b/app/model/StoreModel.js @@ -22,9 +22,13 @@ function storeResource(path, url) { return new Promise((resolve, reject) => { mkdirsSync(_path.dirname(path)); const writeableStream = fs.createWriteStream(path); - request.get({ url: url, timeout: 20000 }).pipe(writeableStream).on('close', () => { - resolve(true); - }); + try { + request.get({ url: url, timeout: 20000 }).pipe(writeableStream).on('close', () => { + resolve(true); + }); + }catch(err) { + console.log(err); + } }); } diff --git a/html/index.html b/html/index.html index 43b52c5..e2b9c7b 100644 --- a/html/index.html +++ b/html/index.html @@ -130,7 +130,7 @@ let server_url = document.location.hostname == '' ? 'http://localhost:5750' : `http://${document.location.hostname}:5750`; const ajax = axios.create({ baseURL: server_url, - timeout: 20000, + timeout: 30000, headers: { 'Content-Type': 'application/x-www-form-urlencoded', //'Access-Control-Allow-Origin': true