nrk / redis-lua

A Lua client library for the redis key value storage system.
MIT License
731 stars 239 forks source link

library is blocking main thread when connection drops #36

Closed ppioter closed 9 years ago

ppioter commented 9 years ago

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 9 years ago

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.