update protocol
This commit is contained in:
@@ -14,7 +14,7 @@ require (
|
|||||||
github.com/google/wire v0.5.0
|
github.com/google/wire v0.5.0
|
||||||
github.com/gorilla/websocket v1.4.2
|
github.com/gorilla/websocket v1.4.2
|
||||||
github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b
|
github.com/jxskiss/base62 v0.0.0-20191017122030-4f11678b909b
|
||||||
github.com/livekit/protocol v0.9.2
|
github.com/livekit/protocol v0.9.3
|
||||||
github.com/magefile/mage v1.11.0
|
github.com/magefile/mage v1.11.0
|
||||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
|
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
|
|||||||
@@ -246,8 +246,8 @@ github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY
|
|||||||
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
|
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
|
||||||
github.com/livekit/ion-sfu v1.20.9 h1:Ih+tE5CXqdL1o6iXfZn+uBoddBXWceaOKVIun6aVuZM=
|
github.com/livekit/ion-sfu v1.20.9 h1:Ih+tE5CXqdL1o6iXfZn+uBoddBXWceaOKVIun6aVuZM=
|
||||||
github.com/livekit/ion-sfu v1.20.9/go.mod h1:g8hwobZI5fvX1RXvayf4ZXkgP7spV5YGE4yTSsumpB4=
|
github.com/livekit/ion-sfu v1.20.9/go.mod h1:g8hwobZI5fvX1RXvayf4ZXkgP7spV5YGE4yTSsumpB4=
|
||||||
github.com/livekit/protocol v0.9.2 h1:ZX5m7DjmRMHtYH5oM85QRMuJlr4feTfD5UL22h9HmtM=
|
github.com/livekit/protocol v0.9.3 h1:rzJwes4AddFF/h47G6kU1/GQF8/meqZ3uihFIKPPxz0=
|
||||||
github.com/livekit/protocol v0.9.2/go.mod h1:MEKn847Iu/2U8ClZyUmEm2oHn8k9fnSHy81Wv8kkSDo=
|
github.com/livekit/protocol v0.9.3/go.mod h1:MEKn847Iu/2U8ClZyUmEm2oHn8k9fnSHy81Wv8kkSDo=
|
||||||
github.com/lucsky/cuid v1.0.2 h1:z4XlExeoderxoPj2/dxKOyPxe9RCOu7yNq9/XWxIUMQ=
|
github.com/lucsky/cuid v1.0.2 h1:z4XlExeoderxoPj2/dxKOyPxe9RCOu7yNq9/XWxIUMQ=
|
||||||
github.com/lucsky/cuid v1.0.2/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE=
|
github.com/lucsky/cuid v1.0.2/go.mod h1:QaaJqckboimOmhRSJXSx/+IT+VTfxfPGSo/6mfgUfmE=
|
||||||
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ const lockExpiration = time.Second * 5
|
|||||||
|
|
||||||
type RecordingService struct {
|
type RecordingService struct {
|
||||||
mb utils.MessageBus
|
mb utils.MessageBus
|
||||||
notifier *webhook.Notifier
|
notifier webhook.Notifier
|
||||||
shutdown chan struct{}
|
shutdown chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRecordingService(mb utils.MessageBus, notifier *webhook.Notifier) *RecordingService {
|
func NewRecordingService(mb utils.MessageBus, notifier webhook.Notifier) *RecordingService {
|
||||||
return &RecordingService{
|
return &RecordingService{
|
||||||
mb: mb,
|
mb: mb,
|
||||||
notifier: notifier,
|
notifier: notifier,
|
||||||
@@ -110,7 +110,7 @@ func (s *RecordingService) EndRecording(ctx context.Context, req *livekit.EndRec
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *RecordingService) resultsWorker() {
|
func (s *RecordingService) resultsWorker() {
|
||||||
sub, err := s.mb.Subscribe(context.Background(), utils.RecordingResultChannel)
|
sub, err := s.mb.SubscribeQueue(context.Background(), utils.RecordingResultChannel)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorw("failed to subscribe to results channel", err)
|
logger.Errorw("failed to subscribe to results channel", err)
|
||||||
return
|
return
|
||||||
@@ -129,22 +129,13 @@ func (s *RecordingService) resultsWorker() {
|
|||||||
}
|
}
|
||||||
s.notify(res)
|
s.notify(res)
|
||||||
case <-s.shutdown:
|
case <-s.shutdown:
|
||||||
sub.Close()
|
_ = sub.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RecordingService) notify(res *livekit.RecordingResult) {
|
func (s *RecordingService) notify(res *livekit.RecordingResult) {
|
||||||
acquired, err := s.mb.Lock(context.Background(), res.Id, lockExpiration)
|
|
||||||
if err != nil {
|
|
||||||
logger.Errorw("failed to lock", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !acquired {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// log results
|
// log results
|
||||||
if res.Error != "" {
|
if res.Error != "" {
|
||||||
logger.Errorw("recording failed", errors.New(res.Error), "id", res.Id)
|
logger.Errorw("recording failed", errors.New(res.Error), "id", res.Id)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type LocalRoomManager struct {
|
|||||||
selector routing.NodeSelector
|
selector routing.NodeSelector
|
||||||
router routing.Router
|
router routing.Router
|
||||||
currentNode routing.LocalNode
|
currentNode routing.LocalNode
|
||||||
notifier *webhook.Notifier
|
notifier webhook.Notifier
|
||||||
rtcConfig *rtc.WebRTCConfig
|
rtcConfig *rtc.WebRTCConfig
|
||||||
config *config.Config
|
config *config.Config
|
||||||
webhookPool *workerpool.WorkerPool
|
webhookPool *workerpool.WorkerPool
|
||||||
@@ -38,7 +38,7 @@ type LocalRoomManager struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewLocalRoomManager(rp RoomStore, router routing.Router, currentNode routing.LocalNode, selector routing.NodeSelector,
|
func NewLocalRoomManager(rp RoomStore, router routing.Router, currentNode routing.LocalNode, selector routing.NodeSelector,
|
||||||
notifier *webhook.Notifier, conf *config.Config) (*LocalRoomManager, error) {
|
notifier webhook.Notifier, conf *config.Config) (*LocalRoomManager, error) {
|
||||||
rtcConf, err := rtc.NewWebRTCConfig(conf, currentNode.Ip)
|
rtcConf, err := rtc.NewWebRTCConfig(conf, currentNode.Ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ func CreateKeyProvider(conf *config.Config) (auth.KeyProvider, error) {
|
|||||||
return auth.NewFileBasedKeyProviderFromMap(conf.Keys), nil
|
return auth.NewFileBasedKeyProviderFromMap(conf.Keys), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateWebhookNotifier(conf *config.Config, provider auth.KeyProvider) (*webhook.Notifier, error) {
|
func CreateWebhookNotifier(conf *config.Config, provider auth.KeyProvider) (webhook.Notifier, error) {
|
||||||
wc := conf.WebHook
|
wc := conf.WebHook
|
||||||
if len(wc.URLs) == 0 {
|
if len(wc.URLs) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user