Skip to content

Commit 0b18eee

Browse files
feat(worker): Add verbose error login when transcoding fails
This enables us to be alerted when a transcode job has failed and react accordingly
1 parent 5ed4367 commit 0b18eee

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

worker/worker/transcode.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import (
1111
"strings"
1212
"time"
1313

14+
log "github.com/sirupsen/logrus"
15+
1416
"github.com/TUM-Dev/gocast/worker/cfg"
1517
"github.com/TUM-Dev/gocast/worker/pb"
16-
log "github.com/sirupsen/logrus"
1718
)
1819

1920
func buildCommand(niceness int, infile string, outfile string, tune string, crf int, self bool) *exec.Cmd {
@@ -97,7 +98,18 @@ func transcode(streamCtx *StreamContext) error {
9798

9899
err = cmd.Wait()
99100
if err != nil {
100-
log.WithFields(log.Fields{"output": output}).Error("Transcoding failed")
101+
host, err := os.Hostname()
102+
if err != nil {
103+
host = "unknown"
104+
}
105+
log.WithFields(log.Fields{
106+
"output": output,
107+
"course": streamCtx.courseSlug,
108+
"stream": streamCtx.streamId,
109+
"variant": streamCtx.streamVersion,
110+
"worker": host,
111+
"cmd": cmd.String(),
112+
}).Error("Transcoding failed")
101113
return fmt.Errorf("transcode stream: %w", fmt.Errorf("%w: %s", err, output))
102114
} else {
103115
log.WithField("stream", streamCtx.getStreamName()).Info("Transcoding finished")

0 commit comments

Comments
 (0)