(self)
| 74 | self.tail = (self.tail + 1) % LIGHTLLM_OUT_TOKEN_QUEUE_SIZE |
| 75 | |
| 76 | def pop(self) -> Tuple[str, int, bool, int]: |
| 77 | if self.is_empty(): |
| 78 | raise Exception("Queue is empty") |
| 79 | |
| 80 | # 移除元素 |
| 81 | item: QueueItem = self.items[self.head] |
| 82 | result = item.get() |
| 83 | |
| 84 | # 更新头部 |
| 85 | self.head = (self.head + 1) % LIGHTLLM_OUT_TOKEN_QUEUE_SIZE |
| 86 | return result |
| 87 | |
| 88 | def peek(self) -> Tuple[str, int, bool, int]: |
| 89 | if self.is_empty(): |