aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/fuzzy_convert.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-08-07 11:41:28 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-08-07 11:41:28 +0100
commit662145d0554de5e769b92dab2d41173a98adcee5 (patch)
treeec28311a0bce6181f248ba7b50304293ad764e44 /lualib/rspamadm/fuzzy_convert.lua
parentbbd88232db43d18f5e0de5a6502848d4074621c5 (diff)
downloadrspamd-662145d0554de5e769b92dab2d41173a98adcee5.tar.gz
rspamd-662145d0554de5e769b92dab2d41173a98adcee5.zip
[Minor] Reformat all Lua code, no functional changes
Diffstat (limited to 'lualib/rspamadm/fuzzy_convert.lua')
-rw-r--r--lualib/rspamadm/fuzzy_convert.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/lualib/rspamadm/fuzzy_convert.lua b/lualib/rspamadm/fuzzy_convert.lua
index 2d473ca46..a31baa4e2 100644
--- a/lualib/rspamadm/fuzzy_convert.lua
+++ b/lualib/rspamadm/fuzzy_convert.lua
@@ -13,13 +13,13 @@ local function connect_redis(server, password, db)
end
if password then
- ret = conn:add_cmd('AUTH', {password})
+ ret = conn:add_cmd('AUTH', { password })
if not ret then
return nil, 'Cannot queue command'
end
end
if db then
- ret = conn:add_cmd('SELECT', {db})
+ ret = conn:add_cmd('SELECT', { db })
if not ret then
return nil, 'Cannot queue command'
end
@@ -126,7 +126,7 @@ local function update_counters(total, redis_host, redis_password, redis_db)
return true
end
-return function (_, res)
+return function(_, res)
local db = sqlite3.open(res['source_db'])
local shingles = {}
local digests = {}
@@ -152,11 +152,11 @@ return function (_, res)
local expire_in = math.floor(now - row.time + res['expiry'])
if expire_in >= 1 then
- table.insert(digests, {row.digest, row.flag, row.value, expire_in})
+ table.insert(digests, { row.digest, row.flag, row.value, expire_in })
num_batch_digests = num_batch_digests + 1
total_digests = total_digests + 1
for srow in db:rows('SELECT value, number FROM shingles WHERE digest_id = ' .. row.id) do
- table.insert(shingles, {srow.value, srow.number, expire_in, row.digest})
+ table.insert(shingles, { srow.value, srow.number, expire_in, row.digest })
total_shingles = total_shingles + 1
num_batch_shingles = num_batch_shingles + 1
end
@@ -188,8 +188,8 @@ return function (_, res)
end
local message = string.format(
- 'Migrated %d digests and %d shingles',
- total_digests, total_shingles
+ 'Migrated %d digests and %d shingles',
+ total_digests, total_shingles
)
if not update_counters(total_digests, res['redis_host'], redis_password, redis_db) then
message = message .. ' but failed to update counters'