Add a command to the queue. Returns True if successful, False if queue is full or disabled.
(self, cmd: QueuedCommand)
| 127 | ) |
| 128 | |
| 129 | def enqueue_command(self, cmd: QueuedCommand) -> bool: |
| 130 | """ |
| 131 | Add a command to the queue. |
| 132 | Returns True if successful, False if queue is full or disabled. |
| 133 | """ |
| 134 | if not self.queue_enabled: |
| 135 | return False |
| 136 | if self.is_queue_full: |
| 137 | return False |
| 138 | self.command_queue.append(cmd) |
| 139 | logger.debug(f"Enqueued command {cmd.request_id} for {self.instance_id} (queue size: {self.queue_size})") |
| 140 | return True |
| 141 | |
| 142 | def dequeue_command(self) -> QueuedCommand | None: |
| 143 | """Get the next command from the queue (FIFO).""" |