lua-nginx-module icon indicating copy to clipboard operation
lua-nginx-module copied to clipboard

Allow cosockets, light threads, semaphores and etc in the context of init_by_lua*

Open agentzh opened this issue 8 years ago • 13 comments

It is desired to enable those Lua APIs that might yield in the context of init_by_lua*. It's particularly useful to have the ability to initiate multiple concurrent light threads to (pre)load crucial metadata from some remote services upon startup.

Under the hood, we can simply plant an event loop in the init_by_lua* handler with a configurable timeout protection (to avoid the server from taking too long to start).

agentzh avatar Mar 25 '17 00:03 agentzh

It's very interesting. Are these any guy to implement this Or It's welcome to initiate a PR :-)

detailyang avatar Mar 26 '17 12:03 detailyang

@detailyang yeah, I'm working for it, but PR welcome also :)

doujiang24 avatar Mar 27 '17 02:03 doujiang24

@doujiang24 You are awesome :) what's you branch name of https://github.com/doujiang24/lua-nginx-module and I'm willing to follow you to learn :smile:

detailyang avatar Mar 27 '17 02:03 detailyang

@detailyang No branch yet, will show you when I have one :)

doujiang24 avatar Mar 27 '17 03:03 doujiang24

This would be awesome. I'd be very interested in trying whatever work in progress.

mikz avatar Jun 30 '17 11:06 mikz

+1 Hey, i'm also interested to create a light thread in init_by_lua* to use resty.redis for read locations from a redis table. This location-entities are used to generated location-files and dynamically reload the nginx.

The current workaround is to create a light thread in init_worker_by_lua* with the ngx.worker.id equals zero and to the location retrieving there.

dayaftereh avatar Aug 03 '17 14:08 dayaftereh

any plans to get this done soon?

manish786 avatar Jan 16 '18 20:01 manish786

Guys, patches welcome :)

agentzh avatar Jan 16 '18 23:01 agentzh

伙计们,欢迎补丁:)

any plans to get this done soon?

dev-zl avatar Dec 16 '20 03:12 dev-zl

Hello @agentzh ,

Any update on this ?

Thanks

x-077 avatar Jul 19 '21 19:07 x-077

ping @doujiang24 @zhuizhuhaomeng

xiaocang avatar Jul 20 '21 15:07 xiaocang

and here is the progress so far https://github.com/openresty/lua-nginx-module/pull/1825

xiaocang avatar Jul 21 '21 07:07 xiaocang

Hello @agentzh, Please review this pr #1825

Thanks

dunker1304 avatar Sep 19 '23 09:09 dunker1304