${result} = Scan Message With Rspamc ${MESSAGE}
Check Rspamc ${result} REDIS (0.00)[hello from lua on redis]
Check Rspamc ${result} REDIS_ASYNC (0.00)[test value]
+ Check Rspamc ${result} REDIS_ASYNC201809 (0.00)[test value]
*** Keywords ***
Lua Setup
Dead Redis client
${result} = Scan Message With Rspamc ${MESSAGE}
Check Rspamc ${result} REDIS_ERROR_3 (0.00)[Connection refused]
+ Check Rspamc ${result} REDIS_ASYNC201809_ERROR (0.00)[Connection refused]
+ Check Rspamc ${result} REDIS_ASYNC_ERROR (0.00)[Connection refused]
*** Keywords ***
Lua Setup
)
end
+local function redis_simple_async_api201809(task)
+ local function redis_cb(err, data)
+ if err then
+ task:insert_result('REDIS_ASYNC201809_ERROR', 1.0, err)
+ else
+ task:insert_result('REDIS_ASYNC201809', 1.0, data)
+ end
+ end
+
+ local attrs = {
+ task = task,
+ callback = redis_cb
+ }
+ local request = {
+ 'GET',
+ 'test_key'
+ }
+ redis_lua.request(redis_params, attrs, request)
+end
+
local function redis_symbol(task)
- local params = lua_util.deepcopy(redis_params)
- params.task = task
- local is_ok, connection = redis_lua.redis_connect_sync(params)
+ local attrs = {task = task}
+ local is_ok, connection = redis_lua.connect(redis_params, attrs)
logger.infox(task, "connect: %1, %2", is_ok, connection)
no_squeeze = true
})
+rspamd_config:register_symbol({
+ name = 'SIMPLE_REDIS_ASYNC201809_TEST',
+ score = 1.0,
+ callback = redis_simple_async_api201809,
+ no_squeeze = true
+})
+
rspamd_config:register_symbol({
name = 'REDIS_TEST',
score = 1.0,