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

init_worker_by_lua + redis - how? #42

Open
kikito opened this issue Apr 9, 2014 · 1 comment
Open

init_worker_by_lua + redis - how? #42

kikito opened this issue Apr 9, 2014 · 1 comment

Comments

@kikito
Copy link

kikito commented Apr 9, 2014

Hi there,

Is there any "legal" way to connect to redis from a worker created via the new init_worker_by_lua* directives?

Anything I try gives me the "API disabled in the context of init_worker_by_lua*" error.

@agentzh
Copy link
Member

agentzh commented Apr 9, 2014

@kikito You cannot directly use cosockets in the context of init_worker_by_lua but you can use them in a timer created by init_worker_by_lua. See

https://github.com/chaoslawful/lua-nginx-module#ngxtimerat

The lua-resty-upstream-healthcheck library uses this trick.

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

2 participants