diff options
Diffstat (limited to 'server/src/async')
-rw-r--r-- | server/src/async/loadfile.lua | 12 | ||||
-rw-r--r-- | server/src/async/scanfiles.lua | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/server/src/async/loadfile.lua b/server/src/async/loadfile.lua new file mode 100644 index 00000000..e5f270fb --- /dev/null +++ b/server/src/async/loadfile.lua @@ -0,0 +1,12 @@ +require 'utility' +local fs = require 'bee.filesystem' + +while true do + local filename = IN:bpop() + local buf = io.load(fs.path(filename)) + if buf then + OUT:push(filename, buf) + end + collectgarbage() + GC:push(ID, collectgarbage 'count') +end diff --git a/server/src/async/scanfiles.lua b/server/src/async/scanfiles.lua index eb3073df..f54b0866 100644 --- a/server/src/async/scanfiles.lua +++ b/server/src/async/scanfiles.lua @@ -47,13 +47,7 @@ for path in scan(fs.path(args.root), filter) do OUT:push 'stop' return end - local buf = io.load(path) - if buf then - OUT:push('file', { - path = fs.absolute(path):string(), - buf = buf, - }) - end + OUT:push('path', fs.absolute(path):string()) end OUT:push 'ok' |