summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-10-20 01:42:02 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-10-20 01:42:02 +0200
commitfa2011dc1a1ac7d62e1bcaee686f9a3f15e27205 (patch)
treeb1eb62fbffb04c65be3b9272398e99db5b931526 /src
parentdaq: replaced non-working fetch lock with limit_conn module of nginx (diff)
daq: nginx-lua now uses on_abort for faster recovery
Diffstat (limited to 'src')
-rw-r--r--src/daq/nginx-lua/s5-nginx.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/daq/nginx-lua/s5-nginx.lua b/src/daq/nginx-lua/s5-nginx.lua
index f1e3719..ab62bab 100644
--- a/src/daq/nginx-lua/s5-nginx.lua
+++ b/src/daq/nginx-lua/s5-nginx.lua
@@ -49,6 +49,7 @@
-- .....
--
-- location /path/to/hls {
+-- .....
-- log_by_lua 's5.log()';
-- }
--
@@ -57,6 +58,7 @@
-- allow ::1;
-- deny all;
-- limit_conn perserver 1;
+-- lua_check_client_abort on;
-- content_by_lua 's5.fetch()';
-- }
--
@@ -106,6 +108,13 @@ end
function _SFIVE.fetch()
ngx.log(ngx.INFO, "SFive(fetch): client connected")
+
+ local ok, err = ngx.on_abort(function() ngx.exit(ngx.HTTP_GONE) end)
+ if not ok then
+ ngx.log(ngx.ERR, "failed to register the on_abort callback: ", err)
+ ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
+ end
+
while true do
logs = sfive_data:get_keys()
for i, k in ipairs(logs) do