diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c index 0f339211..f2e389a7 100644 --- a/plugins/lua/lua_plugin.c +++ b/plugins/lua/lua_plugin.c @@ -15,7 +15,6 @@ extern struct uwsgi_server uwsgi; struct uwsgi_lua { struct lua_State ***state; - int *wsapi_ref; char *shell; char *filename; struct uwsgi_string_list *load; @@ -715,7 +714,6 @@ static int uwsgi_lua_init(){ uwsgi_log("Initializing Lua environment... "); ulua.state = uwsgi_malloc(sizeof(lua_State**) * uwsgi.numproc); - ulua.wsapi_ref = uwsgi_malloc(sizeof(int) * uwsgi.numproc); for (i=0;i 0) { + if(cores > 0) { lua_newtable(L); - for(i=1;i 1 && uwsgi.workers[uwsgi.mywid].cores[wsgi_req->async_id].requests % ulua.gc_freq == 0)) { + lua_gc(L, ulua.gc_full, 0); } return UWSGI_OK; @@ -1236,13 +1241,26 @@ static void uwsgi_lua_hijack(void) { } static void uwsgi_lua_init_apps() { - int i; + int i,j,sid; + + //cores per lua thread + int cores = uwsgi.threads > 1 ? 1 : uwsgi.cores; - if (uwsgi.mywid > 0) { - uwsgi_lua_init_state(uwsgi.mywid); + if (uwsgi.mywid > 0) { // lazy app + sid = ULUA_MYWID*uwsgi.threads; + + for(i=0;i