-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on multiple event loops? #190
Comments
The error you encountered should not occurs in presented reproducer. We worked a fix that should prevent this. But. Something here caught our attention, you are invoking
Moreover you are using Here is what we suggest as a replacement for your script: import asyncio
import niquests
test_url = "https://httpbingo.org/get"
async_test_count = 30
async def async_client_http2_test():
async with niquests.AsyncSession() as s:
await asyncio.gather(
*[s.get(test_url) for _ in range(async_test_count)]
)
async def async_client_multiplexed_http2_test():
async with niquests.AsyncSession(multiplexed=True) as s:
await asyncio.gather(
*[s.get(test_url) for _ in range(async_test_count)]
)
await s.gather()
async def main() -> None:
print('run async_client_http2_test_main')
before = asyncio.get_running_loop().time()
await async_client_http2_test()
print("result", asyncio.get_running_loop().time() - before)
print('run async_client_multiplexed_http2_test_main')
before = asyncio.get_running_loop().time()
await async_client_multiplexed_http2_test()
print("result", asyncio.get_running_loop().time() - before)
if __name__ == "__main__":
asyncio.run(main()) Hope that clarify, |
Hi, I'm testing niquests's AsyncSession's performance while encountering a error. Could you take a look at it and tell me how to fix it please? Thank you!
Expected Result
no error
Actual Result
the output:
Reproduction Steps
System Information
The text was updated successfully, but these errors were encountered: