From b1665f2958f825f047bc337af7f2a70ccec43055 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Thu, 7 Dec 2023 13:07:16 -0800 Subject: [PATCH] actually wait --- pkg/service/service_rpc.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/service/service_rpc.go b/pkg/service/service_rpc.go index e76690fe..e9d74d43 100644 --- a/pkg/service/service_rpc.go +++ b/pkg/service/service_rpc.go @@ -25,6 +25,7 @@ import ( "gopkg.in/yaml.v3" "github.com/livekit/egress/pkg/config" + "github.com/livekit/egress/pkg/errors" "github.com/livekit/protocol/egress" "github.com/livekit/protocol/livekit" "github.com/livekit/protocol/logger" @@ -139,7 +140,13 @@ func (s *Service) launchHandler(req *rpc.StartEgressRequest, info *livekit.Egres } s.AddHandler(req.EgressId, h) - return nil + + select { + case <-h.ready: + return nil + case <-time.After(10 * time.Second): + return errors.ErrEgressNotFound + } } func (s *Service) AddHandler(egressID string, h *Process) {