Переглянути джерело

possible fix for too many races

hmt 3 роки тому
батько
коміт
2cd79094be
1 змінених файлів з 2 додано та 5 видалено
  1. 2 5
      app.ts

+ 2 - 5
app.ts

@@ -10,18 +10,15 @@ let queue: Record<string, Deferred<string>> = {}
 
 const router = Router()
 // if the param is call, check for races
-router.param('call', async (req, res, next, call) => {
-  if (call !== 'create') next()
+router.all('/create', async (req, res, next) => {
   const meeting_id = req.query.meetingID
   const existing_id = queue[meeting_id]
   if (existing_id) {
     console.log(`Race pending for meeting-ID: ${Color.red(meeting_id)}`)
-    const body = await existing_id
-    res.send(body)
   } else {
     queue[meeting_id] = deferred<string>();
-    next()
   }
+  next()
 })
 // the api itself answering to every call
 router.all("/:call", async (req, res, next) => {