diff options
Diffstat (limited to 'server-beta/src/searcher/eachField.lua')
-rw-r--r-- | server-beta/src/searcher/eachField.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/server-beta/src/searcher/eachField.lua b/server-beta/src/searcher/eachField.lua index 11ec2be2..401378b7 100644 --- a/server-beta/src/searcher/eachField.lua +++ b/server-beta/src/searcher/eachField.lua @@ -130,10 +130,6 @@ end --- 获取所有的field function searcher.eachField(source, callback) - local lock <close> = searcher.lock('eachField', source) - if not lock then - return - end local cache = searcher.cache.eachField[source] if cache then for i = 1, #cache do @@ -141,6 +137,10 @@ function searcher.eachField(source, callback) end return end + local unlock = searcher.lock('eachField', source) + if not unlock then + return + end cache = {} searcher.cache.eachField[source] = cache local mark = {} @@ -151,6 +151,9 @@ function searcher.eachField(source, callback) end mark[src] = true cache[#cache+1] = info - callback(info) end) + unlock() + for i = 1, #cache do + callback(cache[i]) + end end |