标记 Token 使用成功
(self, token: str)
| 311 | logger.info(f"✅ 恢复了 {recovered_count} 个失败的 Token") |
| 312 | |
| 313 | def mark_token_success(self, token: str): |
| 314 | """标记 Token 使用成功""" |
| 315 | with self._lock: |
| 316 | if token in self.token_statuses: |
| 317 | status = self.token_statuses[token] |
| 318 | status.total_requests += 1 |
| 319 | status.successful_requests += 1 |
| 320 | status.last_success_time = time.time() |
| 321 | status.failure_count = 0 # 重置失败计数 |
| 322 | |
| 323 | if not status.is_available: |
| 324 | status.is_available = True |
| 325 | logger.info(f"✅ Token 恢复可用: {token[:20]}...") |
| 326 | |
| 327 | def mark_token_failure(self, token: str, error: Exception = None): |
| 328 | """标记 Token 使用失败""" |
no outgoing calls
no test coverage detected