Process the next command in the instance's queue. Called after a command completes.
(self, instance: UnityInstance)
| 409 | self._pending_pongs.pop(instance_id, None) |
| 410 | |
| 411 | async def _process_queue(self, instance: UnityInstance) -> None: |
| 412 | """ |
| 413 | Process the next command in the instance's queue. |
| 414 | Called after a command completes. |
| 415 | """ |
| 416 | if not instance.queue_enabled or not instance.command_queue: |
| 417 | return |
| 418 | |
| 419 | # Get next command from queue |
| 420 | queued_cmd = instance.dequeue_command() |
| 421 | if not queued_cmd: |
| 422 | return |
| 423 | |
| 424 | # Check if the future is still valid (not cancelled/timed out) |
| 425 | if queued_cmd.future.done(): |
| 426 | logger.debug(f"Skipping already-done queued command: {queued_cmd.request_id}") |
| 427 | # Recursively process next in queue |
| 428 | await self._process_queue(instance) |
| 429 | return |
| 430 | |
| 431 | logger.info(f"Processing queued command: {queued_cmd.request_id}") |
| 432 | |
| 433 | # Execute the queued command |
| 434 | result = await self._execute_command( |
| 435 | request_id=queued_cmd.request_id, |
| 436 | instance_id=instance.instance_id, |
| 437 | command=queued_cmd.command, |
| 438 | params=queued_cmd.params, |
| 439 | timeout_ms=queued_cmd.timeout_ms, |
| 440 | ) |
| 441 | |
| 442 | # Set the result on the future |
| 443 | if not queued_cmd.future.done(): |
| 444 | queued_cmd.future.set_result(result) |
| 445 | |
| 446 | # ===== CLI Message Handling ===== |
| 447 |
no test coverage detected