mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
add pcall in launcher
This commit is contained in:
@@ -24,7 +24,10 @@ end
|
|||||||
function command.STAT()
|
function command.STAT()
|
||||||
local list = {}
|
local list = {}
|
||||||
for k,v in pairs(services) do
|
for k,v in pairs(services) do
|
||||||
local stat = skynet.call(k,"debug","STAT")
|
local ok, stat = pcall(skynet.call,k,"debug","STAT")
|
||||||
|
if not ok then
|
||||||
|
stat = string.format("ERROR (%s)",v)
|
||||||
|
end
|
||||||
list[skynet.address(k)] = stat
|
list[skynet.address(k)] = stat
|
||||||
end
|
end
|
||||||
return list
|
return list
|
||||||
@@ -41,9 +44,13 @@ end
|
|||||||
function command.MEM()
|
function command.MEM()
|
||||||
local list = {}
|
local list = {}
|
||||||
for k,v in pairs(services) do
|
for k,v in pairs(services) do
|
||||||
local kb, bytes = skynet.call(k,"debug","MEM")
|
local ok, kb, bytes = pcall(skynet.call,k,"debug","MEM")
|
||||||
|
if not ok then
|
||||||
|
list[skynet.address(k)] = string.format("ERROR (%s)",v)
|
||||||
|
else
|
||||||
list[skynet.address(k)] = string.format("%.2f Kb (%s)",kb,v)
|
list[skynet.address(k)] = string.format("%.2f Kb (%s)",kb,v)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return list
|
return list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user