Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pub/Sub is not tolerant of timeouts #61

Open
drauschenbach opened this issue Jan 18, 2019 · 0 comments
Open

Pub/Sub is not tolerant of timeouts #61

drauschenbach opened this issue Jan 18, 2019 · 0 comments

Comments

@drauschenbach
Copy link

drauschenbach commented Jan 18, 2019

Since Lua uses cooperative multitasking and is single-threaded in most environments, libraries like LuaSocket depend heavily on timeouts and doing small batches of work at a time.

As a Redis subscriber, I have a similar requirement, and want to receive notifications within a function call that has a max-runtime duration budget. So I set a LuaSocket timeout:

client.network.socket:settimeout(0.25)
for message, abort in client:pubsub({subscribe=topics}) do
  -- Handle message and abort
  if (my elapsed time budget is up) then return end
end

But the client library is currently unforgiving of LuaSocket timeout errors and treats them like a hard failure:

lua: .///mytestfile.lua:46: /usr/local/share/lua/5.2/redis.lua:271: attempt to index local 'payload' (a nil value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant