| 27 | self._rr_lock = asyncio.Lock() |
| 28 | |
| 29 | async def _get_pending_count(self, token_id: int, for_image_generation: bool, for_video_generation: bool) -> int: |
| 30 | async with self._pending_lock: |
| 31 | if for_image_generation: |
| 32 | return max(0, int(self._image_pending.get(token_id, 0))) |
| 33 | if for_video_generation: |
| 34 | return max(0, int(self._video_pending.get(token_id, 0))) |
| 35 | return 0 |
| 36 | |
| 37 | async def _add_pending(self, token_id: int, for_image_generation: bool, for_video_generation: bool): |
| 38 | async with self._pending_lock: |