sharemap 和skynet.call之间会有影响吗? #680
Unanswered
pengpengmao
asked this question in
Q&A
Replies: 3 comments
-
如果解决不了就不要用它,想想用好理解的途径解决问题。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
如果skynet.call的时候 会有协成挂起 在挂起期间 writer方被干掉啦 会不会导致reader.update()为false 有这种可能嘛。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
我想,在 skynet 1.1 中还是把 sharemap 移到外面,做成独立的外置模块比较好。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
改前的代码
if itembag_reader:update() then
local seri = skynet.packstring(itembag_reader.__data)
skynet.call("DATABASE", "lua", "SET", DBTABLE.ITEMBAG, uid, seri)
end
if user_reader:update() then
local seri = skynet.packstring(user_reader.__data)
skynet.call("DATABASE", "lua", "SET", DBTABLE.USER, uid, seri)
end
if snapshot_reader:update() then
local seri = skynet.packstring(snapshot_reader.__data)
skynet.call("DATABASE", "lua", "SET", DBTABLE.SNAPSHOT, uid, seri)
end
改后代码
local itembag_update = itembag_reader:update()
local user_update = user_reader:update()
local snapshot_update = user_reader:update()
if itembag_reader:update() then
local seri = skynet.packstring(itembag_reader.__data)
skynet.call("DATABASE", "lua", "SET", DBTABLE.ITEMBAG, uid, seri)
end
if user_update then
local seri = skynet.packstring(user_reader.__data)
skynet.call("DATABASE", "lua", "SET", DBTABLE.USER, uid, seri)
end
if snapshot_update then
local seri = skynet.packstring(snapshot_reader.__data)
skynet.call("DATABASE", "lua", "SET", DBTABLE.SNAPSHOT, uid, seri)
end
平常 改前的代码是好使的, 当压测机器人数据量上来后 我们根据我们的日志发现 第一update 能返回为true skynet.call 后 后面两个update 就不准啦 我们在数据改变地方打了日志 确实有调用相关writer 的 commit()函数 后来我们改成下面的形式 问题是解决啦 但是不理解他们之间会有影响吗。 怀疑问题是skynet.call 会对 sharemap.update有影响。
Beta Was this translation helpful? Give feedback.
All reactions