Skip to content

Commit

Permalink
use StoppableWorkers in part of constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
bashar-515 committed Jan 22, 2025
1 parent 8fd687a commit 3a5e3c7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions rpc/wrtc_call_queue_mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ func NewMongoDBWebRTCCallQueue(
startOnce := make(chan struct{})
var startOnceSync sync.Once

queue.activeBackgroundWorkers.Add(1) // TODO(RSDK-866): remove
utils.ManagedGo(func() { // TODO(RSDK-866): remove
// queue.activeStoppableWorkers.Add(func(ctx context.Context) {
queue.activeStoppableWorkers.Add(func(ctx context.Context) {
defer queue.csManagerSeq.Add(1) // helpful on panicked restart
select {
case <-queue.cancelCtx.Done():
Expand All @@ -241,7 +239,7 @@ func NewMongoDBWebRTCCallQueue(
})
queue.subscriptionManager(newState.ChangeStream)
}
}, queue.activeBackgroundWorkers.Done)
})

select {
case <-queue.cancelCtx.Done():
Expand Down

0 comments on commit 3a5e3c7

Please sign in to comment.