diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-29 19:39:05 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-01-29 19:39:05 +0000 |
commit | 0be70b04fb824e78347d58ce6a49c7a629d5fc28 (patch) | |
tree | b9ff2a6fd9bafd8b89e6e6fc751e6fd568b9a9bc | |
parent | 91d772ab6f6e9f030561654d9dca693518dbd3c3 (diff) | |
download | rspamd-0be70b04fb824e78347d58ce6a49c7a629d5fc28.tar.gz rspamd-0be70b04fb824e78347d58ce6a49c7a629d5fc28.zip |
Avoid using of lua functional
-rw-r--r-- | src/rspamadm/stat_convert.lua | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/rspamadm/stat_convert.lua b/src/rspamadm/stat_convert.lua index 7a64a91e9..7f24890d0 100644 --- a/src/rspamadm/stat_convert.lua +++ b/src/rspamadm/stat_convert.lua @@ -1,7 +1,6 @@ local sqlite3 = require "rspamd_sqlite3" local redis = require "rspamd_redis" local util = require "rspamd_util" -local _ = require "fun" local function send_redis(server, symbol, tokens) local ret = true @@ -14,11 +13,11 @@ local function send_redis(server, symbol, tokens) return false end - _.each(function(t) + for _,t in ipairs(tokens) do if not conn:add_cmd('HINCRBY', {symbol .. t[3], t[1], t[2]}) then ret = false end - end, tokens) + end if ret then ret = conn:exec() @@ -128,7 +127,7 @@ return function (args, res) return end -- Now update all users - _.each(function(id, learned) + for id,learned in pairs(learns) do local user = users_map[id] if not redis.make_request_sync({ host = server, @@ -137,7 +136,7 @@ return function (args, res) }) then print('Cannot update learns for user: ' .. user) end - end, learns) + end db:sql('COMMIT;') print(string.format('Migrated %d tokens for %d users for symbol %s', |