Fixed occasionally occuring "Overload"-problems with luci-httpd
This commit is contained in:
parent
048fe5ce12
commit
95f9bb97ba
1 changed files with 13 additions and 1 deletions
|
@ -41,7 +41,15 @@ end
|
|||
|
||||
function Luci.handle_get(self, request, sourcein, sinkerr)
|
||||
if self.limit and #self.running >= self.limit then
|
||||
return self:failure(503, "Overload")
|
||||
for k, v in ipairs(self.running) do
|
||||
if coroutine.status(v) == "dead" then
|
||||
collectgarbage()
|
||||
break
|
||||
end
|
||||
end
|
||||
if #self.running >= self.limit then
|
||||
return self:failure(503, "Overload")
|
||||
end
|
||||
end
|
||||
table.insert(self.running, coroutine.running())
|
||||
|
||||
|
@ -84,6 +92,10 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
|
|||
return true
|
||||
elseif id == 5 then
|
||||
active = false
|
||||
|
||||
while (coroutine.resume(x)) do
|
||||
end
|
||||
|
||||
return nil
|
||||
elseif id == 4 then
|
||||
return data
|
||||
|
|
Loading…
Reference in a new issue