update protocol
This commit is contained in:
@@ -17,11 +17,11 @@ const lockExpiration = time.Second * 5
|
||||
|
||||
type RecordingService struct {
|
||||
mb utils.MessageBus
|
||||
notifier *webhook.Notifier
|
||||
notifier webhook.Notifier
|
||||
shutdown chan struct{}
|
||||
}
|
||||
|
||||
func NewRecordingService(mb utils.MessageBus, notifier *webhook.Notifier) *RecordingService {
|
||||
func NewRecordingService(mb utils.MessageBus, notifier webhook.Notifier) *RecordingService {
|
||||
return &RecordingService{
|
||||
mb: mb,
|
||||
notifier: notifier,
|
||||
@@ -110,7 +110,7 @@ func (s *RecordingService) EndRecording(ctx context.Context, req *livekit.EndRec
|
||||
}
|
||||
|
||||
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 {
|
||||
logger.Errorw("failed to subscribe to results channel", err)
|
||||
return
|
||||
@@ -129,22 +129,13 @@ func (s *RecordingService) resultsWorker() {
|
||||
}
|
||||
s.notify(res)
|
||||
case <-s.shutdown:
|
||||
sub.Close()
|
||||
_ = sub.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if res.Error != "" {
|
||||
logger.Errorw("recording failed", errors.New(res.Error), "id", res.Id)
|
||||
|
||||
@@ -30,7 +30,7 @@ type LocalRoomManager struct {
|
||||
selector routing.NodeSelector
|
||||
router routing.Router
|
||||
currentNode routing.LocalNode
|
||||
notifier *webhook.Notifier
|
||||
notifier webhook.Notifier
|
||||
rtcConfig *rtc.WebRTCConfig
|
||||
config *config.Config
|
||||
webhookPool *workerpool.WorkerPool
|
||||
@@ -38,7 +38,7 @@ type LocalRoomManager struct {
|
||||
}
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -65,7 +65,7 @@ func CreateKeyProvider(conf *config.Config) (auth.KeyProvider, error) {
|
||||
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
|
||||
if len(wc.URLs) == 0 {
|
||||
return nil, nil
|
||||
|
||||
Reference in New Issue
Block a user