commands.exec takes noticably long
Lemmmy opened this issue ยท 1 comments
Computer #4412 was running about 100 commands.exec() calls, separated by 0.5s. The computer topped the server time graph, peaking ~3.2ms. The issue still occured with commands.async.execute(), and also used the same server time even when separated by 3 seconds.
local f = fs.open("lastRun", "r")
local lastRun = tonumber(f.readAll())
if math.floor(os.epoch("utc") / 1000) - (30 * 60) < lastRun then
error("Not running - not enough time since last run")
end
f.close()
f = fs.open("lastRun", "w")
f.write(tostring(math.floor(os.epoch("utc") / 1000)))
f.close()
print("Fetching computer list to start")
local api = "REDACTED"
local h = http.get(api)
for computer in h.readLine do
write(computer .. ", ")
sleep(.5)
commands.exec("computercraft turn-on " .. computer)
end
h.close()
print("Done")
It's not isolated to computercraft turn-on
; this happened even with tellraw
and other non-intensive commands.
I'm unable to reproduce this problem on a vanilla setup. I suspect this largely overhead with Sponge. VisualVM shows little impact of the command computer code, suggesting the commands themselves are slow to execute.
I'm going to keep this open for now, but labelling as invalid
as I don't think it's on my end.