SemenFrolov
@SemenFrolov
Newbie developer

Как понять lua_code_cache & content_by_lua_file, почему не работает, если включить кеш?

Приветствую, помогите понять как работает lua_code_cache.

Локейшн nginx:
location ~ ^/page/(\d+)/(\d+) {   # items, page number
       default_type 'text/html';
       content_by_lua_file $template_root/index.lua;
       lua_code_cache off;
    }


index.lua :
local http = require "resty.http"
local httpc = http.new()
local cjson = require "cjson"
local template = require "resty.template" 

...

--[[  тут мы ходим по http в сервис, получаем данные, рендерим темплейт ]]--


Все работает ровно до того момента, когда включаем кеш lua_code_cache on; (или комментируем, что одно и тоже)

Ошибка:
2020/03/08 19:51:56 [error] 6#6: *31 lua entry thread aborted: runtime error: [string "context=... or {}..."]:101: bad argument #1 to 'ipairs' (table expected, got number)
openresty_1          | stack traceback:
openresty_1          | coroutine 0:
openresty_1          | 	[C]: in function 'ipairs'
openresty_1          | 	[string "context=... or {}..."]:101: in main chunk
openresty_1          | 	/usr/local/openresty/site/lualib/resty/template.lua:475: in function 'render'
openresty_1          | 	/var/www/lua/index.lua:70: in main chunk, client: 87.117.185.65, server: _, request: "GET / HTTP/1.1", host: "site.com"
  • Вопрос задан
  • 118 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы