(viewUUID: string, command: PdfCommand)
| 418 | setInterval(pruneStaleQueues, SWEEP_INTERVAL_MS).unref(); |
| 419 | |
| 420 | function enqueueCommand(viewUUID: string, command: PdfCommand): void { |
| 421 | let entry = commandQueues.get(viewUUID); |
| 422 | if (!entry) { |
| 423 | entry = { commands: [], lastActivity: Date.now() }; |
| 424 | commandQueues.set(viewUUID, entry); |
| 425 | } |
| 426 | entry.commands.push(command); |
| 427 | entry.lastActivity = Date.now(); |
| 428 | touchView(viewUUID); |
| 429 | |
| 430 | // Wake up any long-polling request waiting for this viewUUID |
| 431 | const waiter = pollWaiters.get(viewUUID); |
| 432 | if (waiter) { |
| 433 | pollWaiters.delete(viewUUID); |
| 434 | waiter(); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | function dequeueCommands(viewUUID: string): PdfCommand[] { |
| 439 | // Poll is activity — keep the view alive even when the queue is empty |
no test coverage detected
searching dependent graphs…