Skip to content

Commit

Permalink
修复压测无法正常工作的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiichi-Origami committed Sep 24, 2024
1 parent 6434f71 commit 3c28d39
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions python/qianfan/resources/requestor/openapi_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@

_T = TypeVar("_T")

_sync_stream_thread_pool = ThreadPoolExecutor(20)


class QfAPIRequestor(BaseAPIRequestor):
"""
Expand All @@ -72,6 +70,7 @@ def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
self._token_limiter = TokenLimiter(**kwargs)
self._async_token_limiter = AsyncTokenLimiter(**kwargs)
self._sync_stream_thread_pool = ThreadPoolExecutor(20)

def _retry_if_token_expired(self, func: Callable[..., _T]) -> Callable[..., _T]:
"""
Expand Down Expand Up @@ -488,7 +487,7 @@ def _inner_worker() -> None:

is_closed = True

_sync_stream_thread_pool.submit(_inner_worker)
self._sync_stream_thread_pool.submit(_inner_worker)
while not is_closed or not data.empty():
try:
yield data.get(timeout=0.5)
Expand Down

0 comments on commit 3c28d39

Please sign in to comment.