mirror of
https://github.com/datarhei/core.git
synced 2025-10-04 23:53:12 +08:00
Allow probe with individual timeout
This commit is contained in:
@@ -48,6 +48,7 @@ type Restreamer interface {
|
|||||||
GetProcessLog(id string) (*app.Log, error) // Get the logs of a process
|
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
|
GetPlayout(id, inputid string) (string, error) // Get the URL of the playout API for a process
|
||||||
Probe(id string) app.Probe // Probe 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
|
Skills() skills.Skills // Get the ffmpeg skills
|
||||||
ReloadSkills() error // Reload the ffmpeg skills
|
ReloadSkills() error // Reload the ffmpeg skills
|
||||||
SetProcessMetadata(id, key string, data interface{}) error // Set metatdata to a process
|
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 {
|
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()
|
r.lock.RLock()
|
||||||
|
|
||||||
appprobe := app.Probe{}
|
appprobe := app.Probe{}
|
||||||
@@ -1288,7 +1293,7 @@ func (r *restream) Probe(id string) app.Probe {
|
|||||||
ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{
|
ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{
|
||||||
Reconnect: false,
|
Reconnect: false,
|
||||||
ReconnectDelay: 0,
|
ReconnectDelay: 0,
|
||||||
StaleTimeout: 20 * time.Second,
|
StaleTimeout: timeout,
|
||||||
Command: command,
|
Command: command,
|
||||||
Parser: prober,
|
Parser: prober,
|
||||||
Logger: task.logger,
|
Logger: task.logger,
|
||||||
|
@@ -394,6 +394,19 @@ func TestReloadProcess(t *testing.T) {
|
|||||||
rs.StopProcess(process.ID)
|
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) {
|
func TestProcessMetadata(t *testing.T) {
|
||||||
rs, err := getDummyRestreamer(nil, nil, nil, nil)
|
rs, err := getDummyRestreamer(nil, nil, nil, nil)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
Reference in New Issue
Block a user