MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / mark_token_success

Method mark_token_success

app/utils/token_pool.py:313–325  ·  view source on GitHub ↗

标记 Token 使用成功

(self, token: str)

Source from the content-addressed store, hash-verified

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 使用失败"""

Callers 1

record_token_successMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected