nrk/redis-lua

library is blocking main thread when connection drops

ppioter opened this issue · 1 comments

example:
I issue command: redis:ping(), connection drops, it takes around 10s for main thread to resume, are there any workarounds?

it would be nice to have it as non-blocking library, where you could issue
commands like that

local callback=function(event)
local response=event.response
if response=="PONG" then return "pong"
elseif response=="TIMEOUT" then --do time-out-case stuff here --
elseif response=="ERROR" then --do error-case stuff here --
end
end

redis:ping(callback)

nrk commented

Hi @ppioter,

This is something that has been discussed in the past in #15 (but was limited to the luvit runtime) while my response in #31 still reflects my current stance on the matter. If non-blocking support will ever be implemented for redis-lua, it's not going to be anytime soon.