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

Method record_usage

src/services/token_manager.py:953–960  ·  view source on GitHub ↗

Record token usage

(self, token_id: int, is_video: bool = False)

Source from the content-addressed store, hash-verified

951 raise ValueError(f"Failed to prepare project pool: {str(e)}")
952
953 async def record_usage(self, token_id: int, is_video: bool = False):
954 """Record token usage"""
955 await self.db.update_token(token_id, use_count=1, last_used_at=datetime.now())
956
957 if is_video:
958 await self.db.increment_token_stats(token_id, "video")
959 else:
960 await self.db.increment_token_stats(token_id, "image")
961
962 async def record_error(self, token_id: int):
963 """Record token error and auto-disable if threshold reached"""

Callers 1

handle_generationMethod · 0.80

Calls 2

increment_token_statsMethod · 0.80
update_tokenMethod · 0.45

Tested by

no test coverage detected