- 10
- 13
Спасибо.Можно просто юзать effil и через отдельный поток сделать запрос, в таком случае микрофризов не будет. По такому принципу работает большинство скриптов от Эвольва - гтулс, епресс, ечат и другое.
example:local effil = require "effil" local requests = require "requests" local cjson = require "cjson" local httpThread = nil local result = nil function requestAsync(nick) httpThread = effil.thread(function(nick) local requests = require "requests" local cjson = require "cjson" local response = requests.post("https://logs.evolve-rp.ru/saint-louis", { data = { nickname = nick } }) if response.status_code ~= 200 then return { success = false, error = response.status_code } end local data = cjson.decode(response.text) return { success = true, data = data } end)(nick) end function main() while true do wait(0) if httpThread then if httpThread:status() == "completed" then result = httpThread:get() httpThread = nil if result.success then logs = result.data else print("Ошибка HTTP") end end end end end
Исправил в коде, теперь запрос выполняется через effil в отдельном потоке, поэтому микрофризов нет. Список обновляется только по команде /admins, без лишних сообщений. Всё работает плавно.