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

Method release_pending

src/services/load_balancer.py:44–57  ·  view source on GitHub ↗
(self, token_id: int, for_image_generation: bool = False, for_video_generation: bool = False)

Source from the content-addressed store, hash-verified

42 self._video_pending[token_id] = max(0, int(self._video_pending.get(token_id, 0))) + 1
43
44 async def release_pending(self, token_id: int, for_image_generation: bool = False, for_video_generation: bool = False):
45 async with self._pending_lock:
46 if for_image_generation:
47 current = max(0, int(self._image_pending.get(token_id, 0)))
48 if current <= 1:
49 self._image_pending.pop(token_id, None)
50 else:
51 self._image_pending[token_id] = current - 1
52 elif for_video_generation:
53 current = max(0, int(self._video_pending.get(token_id, 0)))
54 if current <= 1:
55 self._video_pending.pop(token_id, None)
56 else:
57 self._video_pending[token_id] = current - 1
58
59 async def _get_token_load(self, token_id: int, for_image_generation: bool, for_video_generation: bool) -> tuple[int, Optional[int]]:
60 """获取 token 当前负载。

Callers 1

handle_generationMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected