MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / is_at_valid

Method is_at_valid

src/services/token_manager.py:549–561  ·  view source on GitHub ↗

检查AT是否有效,如果无效或即将过期则自动刷新 Returns: True if AT is valid or refreshed successfully False if AT cannot be refreshed

(self, token_id: int, token: Optional[Token] = None)

Source from the content-addressed store, hash-verified

547 return await self.db.get_token(token.id)
548
549 async def is_at_valid(self, token_id: int, token: Optional[Token] = None) -> bool:
550 """检查AT是否有效,如果无效或即将过期则自动刷新
551
552 Returns:
553 True if AT is valid or refreshed successfully
554 False if AT cannot be refreshed
555 """
556 token_obj = token if token and token.id == token_id else await self.db.get_token(token_id)
557 if not token_obj:
558 return False
559
560 valid_token = await self.ensure_valid_token(token_obj)
561 return valid_token is not None
562
563
564 async def _refresh_at_inner(self, token_id: int) -> bool:

Callers

nothing calls this directly

Calls 2

ensure_valid_tokenMethod · 0.95
get_tokenMethod · 0.45

Tested by

no test coverage detected