summaryrefslogtreecommitdiff
path: root/src/daq
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2014-10-18 20:45:04 +0200
committerChristian Pointner <equinox@spreadspace.org>2014-10-18 22:36:09 +0200
commit0e5baeed287186a786ecb89b10d534697cf93c12 (patch)
tree97726d2a8875d9207f4fa48c9869947bda320e4d /src/daq
parentextend TODO (diff)
daq: nginx-lua - added workaround for write buffer overrun
Diffstat (limited to 'src/daq')
-rw-r--r--src/daq/nginx-lua/s5-nginx.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/daq/nginx-lua/s5-nginx.lua b/src/daq/nginx-lua/s5-nginx.lua
index c38b692..6559e95 100644
--- a/src/daq/nginx-lua/s5-nginx.lua
+++ b/src/daq/nginx-lua/s5-nginx.lua
@@ -130,9 +130,17 @@ local send_data = function(sock, starttime)
'"quality": "' .. s.quality .. '" }, '
json = json .. '"data": ' .. get_data_streamer(s.content, s.format, s.quality)
json = json .. '}\n'
- local ok, err = sock:send(json)
- if not ok then
- return nil, err
+ while true do
+ -- TODO: this should probably be done inside a seperate writer thread
+ local ok, err = sock:send(json)
+ if not ok then
+ if err ~= "resource temporarily unavailable" then
+ return nil, err
+ end
+ ngx.sleep(0.02)
+ else
+ break
+ end
end
end
return true