diff --git a/pkg/handler/handler.go b/pkg/handler/handler.go index e0058f39..4219745e 100644 --- a/pkg/handler/handler.go +++ b/pkg/handler/handler.go @@ -115,9 +115,6 @@ func (h *Handler) Run() { } func (h *Handler) Kill() { - // kill signal received - h.conf.Info.Details = "service terminated by deployment" - <-h.initialized.Watch() - h.controller.SendEOS(context.Background()) + h.controller.SendEOS(context.Background(), "handler killed") } diff --git a/pkg/handler/handler_rpc.go b/pkg/handler/handler_rpc.go index 96c3532f..2bc76b87 100644 --- a/pkg/handler/handler_rpc.go +++ b/pkg/handler/handler_rpc.go @@ -47,6 +47,6 @@ func (h *Handler) StopEgress(ctx context.Context, _ *livekit.StopEgressRequest) return nil, errors.ErrEgressNotFound } - h.controller.SendEOS(ctx) + h.controller.SendEOS(ctx, "StopEgress API") return (*livekit.EgressInfo)(h.controller.Info), nil } diff --git a/pkg/pipeline/controller.go b/pkg/pipeline/controller.go index 916e9c52..2a73ebb4 100644 --- a/pkg/pipeline/controller.go +++ b/pkg/pipeline/controller.go @@ -16,6 +16,7 @@ package pipeline import ( "context" + "fmt" "sync" "time" @@ -205,7 +206,7 @@ func (c *Controller) Run(ctx context.Context) *info.EgressInfo { // close when room ends go func() { <-c.src.EndRecording() - c.SendEOS(ctx) + c.SendEOS(ctx, "source closed") }() // wait until room is ready @@ -373,7 +374,7 @@ func (c *Controller) removeSink(ctx context.Context, url string, streamErr error if streamErr != nil { return streamErr } else { - c.SendEOS(ctx) + c.SendEOS(ctx, "all streams removed") return nil } } @@ -387,7 +388,7 @@ func (c *Controller) removeSink(ctx context.Context, url string, streamErr error return c.streamBin.RemoveStream(url) } -func (c *Controller) SendEOS(ctx context.Context) { +func (c *Controller) SendEOS(ctx context.Context, reason string) { ctx, span := tracer.Start(ctx, "Pipeline.SendEOS") defer span.End() @@ -396,6 +397,7 @@ func (c *Controller) SendEOS(ctx context.Context) { c.limitTimer.Stop() } + c.Info.Details = fmt.Sprintf("end reason: %s", reason) switch c.Info.Status { case livekit.EgressStatus_EGRESS_STARTING: c.Info.SetAborted(info.MsgStoppedBeforeStarted) @@ -507,7 +509,7 @@ func (c *Controller) startSessionLimitTimer(ctx context.Context) { c.Info.SetLimitReached() } if c.playing.IsBroken() { - c.SendEOS(ctx) + c.SendEOS(ctx, "time limit reached") } else { c.p.Stop() } diff --git a/pkg/pipeline/source/web.go b/pkg/pipeline/source/web.go index 2b69332d..f9c03cc4 100644 --- a/pkg/pipeline/source/web.go +++ b/pkg/pipeline/source/web.go @@ -309,13 +309,6 @@ func (s *WebSource) launchChrome(ctx context.Context, p *config.PipelineConfig, case *runtime.EventExceptionThrown: logChrome("exception", ev) - if s.info.Details == "" { - if exceptionDetails := ev.ExceptionDetails; exceptionDetails != nil { - if exception := exceptionDetails.Exception; exception != nil { - s.info.Details = fmt.Sprintf("Uncaught chrome exception: %s", exception.Description) - } - } - } } })