From 2a680b1095bb7cb80869d7fb60cc601cce560d54 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 28 Nov 2021 20:55:33 +0100 Subject: Fix optional socket dependency --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index 368ffa9..b5cb92e 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,5 @@ lua_async = {} -if rawget(_G, "require") then - lua_async.socket = require("socket") -end - function lua_async.clock() return lua_async.socket and lua_async.socket.gettime() or os.clock() end @@ -25,7 +21,11 @@ function lua_async.step(dtime) -- close phase is obsolete end -return function(path) +return function(path, no_socket) + if not no_socket then + lua_async.socket = require("socket") + end + for _, f in ipairs { "timeouts", "intervals", -- cgit v1.2.3 From 21b795f826f5d2d36d45677f1e6c4118ef850846 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 29 Nov 2021 23:38:43 +0100 Subject: Fix promise rejection catching --- promises.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/promises.lua b/promises.lua index 29bcdab..e654458 100644 --- a/promises.lua +++ b/promises.lua @@ -39,6 +39,7 @@ function PromisePrototype:__reject_raw(reason) local any_child = false for _, child in ipairs(self.__children) do + any_child = true child:reject(reason) end -- cgit v1.2.3