Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
fix starting pusher whe inappropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
jprjr committed Mar 31, 2017
1 parent 5b4bb13 commit c627194
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ app:match('publish-start',config.http_prefix .. '/on-publish', respond_to({
stream_status.data_incoming = true
streams_dict:set(stream.id, to_json(stream_status))

if stream.preview_required == 0 then
if stream.preview_required == 0 and #sas > 0 then
for _,v in pairs(sas) do
local account = v[1]
local sa = v[2]
Expand Down
24 changes: 21 additions & 3 deletions multistreamer/process_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,30 @@ function ProcessMgr:startPush(msg)
self.pushers[stream.id] = spawn(function()
local prog = exec.new(config.sockexec_path)
prog.timeout_fatal = false
while true do

local running = true
while running do
local res = prog(bash_path,'-l',lua_bin,'-e',os.getenv('LAPIS_ENVIRONMENT'),'push',stream.uuid)
ngx_log(ngx_debug,'[Process Manager] Pusher ended')
log_result(res,'Pusher')

ngx_log(ngx.NOTICE,'[Process Manager] Pusher ended')
-- log_result(res,'Pusher')

ngx_sleep(10)
local stream_status = streams_dict:get(stream.id)
if stream_status then
stream_status = from_json(stream_status)
else
stream_status = {
data_incoming = false,
data_pushing = false,
data_pulling = false,
}
end
if stream_status.data_incoming == false then
running = false
end
end

end)

return true
Expand Down

0 comments on commit c627194

Please sign in to comment.