From 87e441a1d2418c8a5301ff096c875ef50bbc6036 Mon Sep 17 00:00:00 2001 From: Mizore Date: Thu, 9 Feb 2023 18:48:06 +0800 Subject: [PATCH] =?UTF-8?q?:wastebasket:=20LuatOS=20bug=20=E5=B7=B2?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D,=20=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8=20`s?= =?UTF-8?q?ys.waitUntil`=20=E5=88=A4=E6=96=AD=20http=20=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/util_http.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/script/util_http.lua b/script/util_http.lua index 8fa01fd..918d7de 100644 --- a/script/util_http.lua +++ b/script/util_http.lua @@ -23,16 +23,11 @@ function util_http.fetch(timeout, method, url, headers, body) util_netled.blink(50, 50) - sys.taskInit( - function() - log.debug("util_http.fetch", "开始请求", "id:", id) - res_code, res_headers, res_body = http.request(method, url, headers, body, opts).wait() - log.debug("util_http.fetch", "请求结束", "id:", id, "code:", res_code) - sys.publish(id) - end - ) - local result = sys.waitUntil(id, timeout + 1000 * 25) - if not result or res_code == -8 then + log.debug("util_http.fetch", "开始请求", "id:", id) + res_code, res_headers, res_body = http.request(method, url, headers, body, opts).wait() + log.debug("util_http.fetch", "请求结束", "id:", id, "code:", res_code) + + if res_code == -8 then log.warn("util_http.fetch", "请求超时", "id:", id) end