mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
bugfix: profile queue accept
This commit is contained in:
@@ -93,7 +93,8 @@ lresume(lua_State *L) {
|
|||||||
} else {
|
} else {
|
||||||
lua_pop(L,1);
|
lua_pop(L,1);
|
||||||
lua_pushvalue(L,1);
|
lua_pushvalue(L,1);
|
||||||
lua_pushnumber(L, get_time());
|
double ti = get_time();
|
||||||
|
lua_pushnumber(L, ti);
|
||||||
lua_rawset(L, lua_upvalueindex(1)); // set start time
|
lua_rawset(L, lua_upvalueindex(1)); // set start time
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ lyield(lua_State *L) {
|
|||||||
|
|
||||||
lua_pushthread(L);
|
lua_pushthread(L);
|
||||||
lua_pushnumber(L, ti);
|
lua_pushnumber(L, ti);
|
||||||
lua_rawset(L, lua_upvalueindex(1));
|
lua_rawset(L, lua_upvalueindex(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_CFunction co_yield = lua_tocfunction(L, lua_upvalueindex(3));
|
lua_CFunction co_yield = lua_tocfunction(L, lua_upvalueindex(3));
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ local function message_dispatch()
|
|||||||
if f then
|
if f then
|
||||||
if method[2] == "accept" then
|
if method[2] == "accept" then
|
||||||
-- no return
|
-- no return
|
||||||
|
profile.start()
|
||||||
local ok, data = pcall(f, table.unpack(msg))
|
local ok, data = pcall(f, table.unpack(msg))
|
||||||
|
local ti = profile.stop()
|
||||||
|
update_stat(method[3], ti)
|
||||||
if not ok then
|
if not ok then
|
||||||
print(string.format("Error on [:%x] to [:%x] %s", msg.source, skynet.self(), tostring(data)))
|
print(string.format("Error on [:%x] to [:%x] %s", msg.source, skynet.self(), tostring(data)))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user