LINXD-2209: Check queue length
This commit is contained in:
12
app.js
12
app.js
@ -118,11 +118,13 @@ const mediaCodecs = [
|
||||
}
|
||||
|
||||
setInterval(async () => {
|
||||
const { callId, callback } = queue.shift();
|
||||
if (router[callId] === undefined) {
|
||||
router[callId] = await worker.createRouter({ mediaCodecs })
|
||||
console.log(`[createRoom] Router ID: ${router[callId].id}`)
|
||||
getRtpCapabilities(callId, callback)
|
||||
if (queue.length > 0) {
|
||||
const { callId, callback } = queue.shift();
|
||||
if (router[callId] === undefined) {
|
||||
router[callId] = await worker.createRouter({ mediaCodecs })
|
||||
console.log(`[createRoom] Router ID: ${router[callId].id}`)
|
||||
getRtpCapabilities(callId, callback)
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
|
Reference in New Issue
Block a user