summaryrefslogtreecommitdiff
path: root/server-beta/src/searcher/eachRef.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/searcher/eachRef.lua')
-rw-r--r--server-beta/src/searcher/eachRef.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/server-beta/src/searcher/eachRef.lua b/server-beta/src/searcher/eachRef.lua
index 4cefa405..7b2e3a27 100644
--- a/server-beta/src/searcher/eachRef.lua
+++ b/server-beta/src/searcher/eachRef.lua
@@ -330,10 +330,6 @@ end
--- 获取所有的引用
function searcher.eachRef(source, callback)
- local lock <close> = searcher.lock('eachRef', source)
- if not lock then
- return
- end
local cache = searcher.cache.eachRef[source]
if cache then
for i = 1, #cache do
@@ -341,6 +337,10 @@ function searcher.eachRef(source, callback)
end
return
end
+ local unlock = searcher.lock('eachRef', source)
+ if not unlock then
+ return
+ end
cache = {}
searcher.cache.eachRef[source] = cache
local mark = {}
@@ -351,6 +351,9 @@ function searcher.eachRef(source, callback)
end
mark[src] = true
cache[#cache+1] = info
- callback(info)
end)
+ unlock()
+ for i = 1, #cache do
+ callback(cache[i])
+ end
end