Allow probe with individual timeout
This commit is contained in:
parent
505fbff03f
commit
b2cd8f7133
2 changed files with 43 additions and 25 deletions
|
|
@ -48,6 +48,7 @@ type Restreamer interface {
|
|||
GetProcessLog(id string) (*app.Log, error) // Get the logs of a process
|
||||
GetPlayout(id, inputid string) (string, error) // Get the URL of the playout API for a process
|
||||
Probe(id string) app.Probe // Probe a process
|
||||
ProbeWithTimeout(id string, timeout time.Duration) app.Probe // Probe a process with specific timeout
|
||||
Skills() skills.Skills // Get the ffmpeg skills
|
||||
ReloadSkills() error // Reload the ffmpeg skills
|
||||
SetProcessMetadata(id, key string, data interface{}) error // Set metatdata to a process
|
||||
|
|
@ -1251,6 +1252,10 @@ func (r *restream) GetProcessLog(id string) (*app.Log, error) {
|
|||
}
|
||||
|
||||
func (r *restream) Probe(id string) app.Probe {
|
||||
return r.ProbeWithTimeout(id, 20*time.Second)
|
||||
}
|
||||
|
||||
func (r *restream) ProbeWithTimeout(id string, timeout time.Duration) app.Probe {
|
||||
r.lock.RLock()
|
||||
|
||||
appprobe := app.Probe{}
|
||||
|
|
@ -1288,7 +1293,7 @@ func (r *restream) Probe(id string) app.Probe {
|
|||
ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{
|
||||
Reconnect: false,
|
||||
ReconnectDelay: 0,
|
||||
StaleTimeout: 20 * time.Second,
|
||||
StaleTimeout: timeout,
|
||||
Command: command,
|
||||
Parser: prober,
|
||||
Logger: task.logger,
|
||||
|
|
|
|||
|
|
@ -394,6 +394,19 @@ func TestReloadProcess(t *testing.T) {
|
|||
rs.StopProcess(process.ID)
|
||||
}
|
||||
|
||||
func TestProbeProcess(t *testing.T) {
|
||||
rs, err := getDummyRestreamer(nil, nil, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
process := getDummyProcess()
|
||||
|
||||
rs.AddProcess(process)
|
||||
|
||||
probe := rs.ProbeWithTimeout(process.ID, 5*time.Second)
|
||||
|
||||
require.Equal(t, 3, len(probe.Streams))
|
||||
}
|
||||
|
||||
func TestProcessMetadata(t *testing.T) {
|
||||
rs, err := getDummyRestreamer(nil, nil, nil, nil)
|
||||
require.NoError(t, err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue