diff --git a/app.lua b/app.lua index e61b4f4..58ca7eb 100644 --- a/app.lua +++ b/app.lua @@ -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] diff --git a/multistreamer/process_manager.lua b/multistreamer/process_manager.lua index 1a1db8c..33f4cbd 100644 --- a/multistreamer/process_manager.lua +++ b/multistreamer/process_manager.lua @@ -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