summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/metadata_exporter.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-11-14 15:54:21 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-11-14 15:54:21 +0200
commit3590c28e73e34649d15c401db7ee6f4142a8a753 (patch)
tree2f905347a97129679251cc77d53d72291061df4a /src/plugins/lua/metadata_exporter.lua
parentaedd9207b6d7e03bb13fb3866a3d54d32982d12b (diff)
downloadrspamd-3590c28e73e34649d15c401db7ee6f4142a8a753.tar.gz
rspamd-3590c28e73e34649d15c401db7ee6f4142a8a753.zip
[Minor] Lint Lua plugins & global functions
Diffstat (limited to 'src/plugins/lua/metadata_exporter.lua')
-rw-r--r--src/plugins/lua/metadata_exporter.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/lua/metadata_exporter.lua b/src/plugins/lua/metadata_exporter.lua
index 62fdc0d64..70c10e6b7 100644
--- a/src/plugins/lua/metadata_exporter.lua
+++ b/src/plugins/lua/metadata_exporter.lua
@@ -46,18 +46,18 @@ if url then
rspamd_http = require "rspamd_http"
end
if opts['select'] then
- settings.select = assert(loadstring(opts['select']))()
+ settings.select = assert(load(opts['select']))()
end
if opts['format'] then
- settings.format = assert(loadstring(opts['format']))()
+ settings.format = assert(load(opts['format']))()
end
if opts['mime_type'] then
settings['mime_type'] = opts['mime_type']
end
local function metadata_exporter(task)
- local ret,conn,upstream
- local function http_callback(err, code, body, headers)
+ local _,ret,upstream
+ local function http_callback(err, code)
if err then
rspamd_logger.errx(task, 'got error %s in http callback', err)
end
@@ -65,7 +65,7 @@ local function metadata_exporter(task)
rspamd_logger.errx(task, 'got unexpected http status: %s', code)
end
end
- local function redis_set_cb(err, data)
+ local function redis_set_cb(err)
if err then
rspamd_logger.errx(task, 'got error %s when publishing record on server %s',
err, upstream:get_addr())
@@ -84,7 +84,7 @@ local function metadata_exporter(task)
return
end
if channel then
- ret,conn,upstream = rspamd_redis_make_request(task,
+ ret,_,upstream = rspamd_redis_make_request(task,
redis_params, -- connect params
nil, -- hash key
true, -- is write
@@ -92,6 +92,10 @@ local function metadata_exporter(task)
'PUBLISH', -- command
{channel, data} -- arguments
)
+ if not ret then
+ rspamd_logger.errx(task, 'Redis PUBLISH failed')
+ upstream:fail()
+ end
end
if url then
rspamd_http.request({