sleep time 1s-> 1m, sleep 1s prodcut more message

This commit is contained in:
fanyh
2018-08-09 18:42:06 +08:00
committed by 云风
parent 281acf4c71
commit 168a07d658

View File

@@ -8,7 +8,7 @@ local NORET = {}
local pool = {}
local pool_count = {}
local objmap = {}
local collect_tick = 600
local collect_tick = 10
local function newobj(name, tbl)
assert(pool[name] == nil)
@@ -20,17 +20,17 @@ local function newobj(name, tbl)
pool_count[name] = { n = 0, threshold = 16 }
end
local function collect10sec()
if collect_tick > 10 then
collect_tick = 10
local function collect1min()
if collect_tick > 1 then
collect_tick = 1
end
end
local function collectobj()
while true do
skynet.sleep(100) -- sleep 1s
skynet.sleep(60*100) -- sleep 1min
if collect_tick <= 0 then
collect_tick = 600 -- reset tick count to 600 sec
collect_tick = 10 -- reset tick count to 10 min
collectgarbage()
for obj, v in pairs(objmap) do
if v == true then
@@ -121,7 +121,7 @@ function CMD.update(name, t, ...)
response(true, newobj)
end
end
collect10sec() -- collect in 10 sec
collect1min() -- collect in 1 min
end
local function check_watch(queue)