mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
sleep time 1s-> 1m, sleep 1s prodcut more message
This commit is contained in:
@@ -8,7 +8,7 @@ local NORET = {}
|
|||||||
local pool = {}
|
local pool = {}
|
||||||
local pool_count = {}
|
local pool_count = {}
|
||||||
local objmap = {}
|
local objmap = {}
|
||||||
local collect_tick = 600
|
local collect_tick = 10
|
||||||
|
|
||||||
local function newobj(name, tbl)
|
local function newobj(name, tbl)
|
||||||
assert(pool[name] == nil)
|
assert(pool[name] == nil)
|
||||||
@@ -20,17 +20,17 @@ local function newobj(name, tbl)
|
|||||||
pool_count[name] = { n = 0, threshold = 16 }
|
pool_count[name] = { n = 0, threshold = 16 }
|
||||||
end
|
end
|
||||||
|
|
||||||
local function collect10sec()
|
local function collect1min()
|
||||||
if collect_tick > 10 then
|
if collect_tick > 1 then
|
||||||
collect_tick = 10
|
collect_tick = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function collectobj()
|
local function collectobj()
|
||||||
while true do
|
while true do
|
||||||
skynet.sleep(100) -- sleep 1s
|
skynet.sleep(60*100) -- sleep 1min
|
||||||
if collect_tick <= 0 then
|
if collect_tick <= 0 then
|
||||||
collect_tick = 600 -- reset tick count to 600 sec
|
collect_tick = 10 -- reset tick count to 10 min
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
for obj, v in pairs(objmap) do
|
for obj, v in pairs(objmap) do
|
||||||
if v == true then
|
if v == true then
|
||||||
@@ -121,7 +121,7 @@ function CMD.update(name, t, ...)
|
|||||||
response(true, newobj)
|
response(true, newobj)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
collect10sec() -- collect in 10 sec
|
collect1min() -- collect in 1 min
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_watch(queue)
|
local function check_watch(queue)
|
||||||
|
|||||||
Reference in New Issue
Block a user