mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:27:34 +00:00
add: optimisation of the requestAverage calcul
This commit is contained in:
parent
42a216dfb6
commit
1ce99b7e76
|
@ -95,13 +95,17 @@ function gmInte.http.post(endpoint, data, onSuccess, onFailed)
|
|||
end
|
||||
|
||||
local nextLogPacket = {}
|
||||
function gmInte.http.postLog(endpoint, data)
|
||||
local requestAverage = 0
|
||||
timer.Create("gmInte:http:requestAverage", 1, 0, function()
|
||||
requestAverage = 0
|
||||
for k, v in ipairs(requestIndicator) do
|
||||
requestAverage = requestAverage + v
|
||||
end
|
||||
|
||||
requestAverage = requestAverage / 10
|
||||
end)
|
||||
|
||||
function gmInte.http.postLog(endpoint, data)
|
||||
if requestAverage >= 2 then
|
||||
local logPacketIndex = #nextLogPacket + 1
|
||||
table.insert(nextLogPacket, {
|
||||
|
|
Loading…
Reference in New Issue
Block a user