python-wargaming icon indicating copy to clipboard operation
python-wargaming copied to clipboard

aiohttp

Open vanous opened this issue 8 years ago • 4 comments

Hy all,

:)

thanks for the nice library, have been using it for a discord bot for blitz. Have you considered moving to aiohttp for 3.6 async stuff? I will perhaps try it internally, but am not sure about full legacy python and python support...

cheers Petr

vanous avatar Jan 20 '18 13:01 vanous

Hi, so i have tried, but have failed, due to the complexity of how the library tries to autodetect stuff etc through iterators... It probably is not so complicated, but i have no experience with async code. If i can help in any way, let me know...

thank you P.

vanous avatar Jan 23 '18 17:01 vanous

Hi @vanous

Thanks for your question, but unfortunately this library will not implement async functionality in nearest future. I don't have much experience with async/await, so I can't do it same best as it is right now.

monester avatar Jan 24 '18 12:01 monester

Hi Alex,

thank you for getting back to me. Same almost zero experience with async on my side. I have used aiohttp previously (the replacement for requests) so i will probably slowly convert from your (really nice) library to direct aiohtp json calls. My issue and reason for it is, that as the usage of my bot goes higher, it is happening more and more frequently that people use some of the more complex commands, which pull data from several WG endpoint and the blocking causes the discord.py to restart.

Thank you for for all the work!

cheers

Petr

vanous avatar Jan 24 '18 18:01 vanous

Hi Alex,

Just for you or anyone else interested. I have ended up wrapping the WG calls into asyncio loop.run_in_executor, which should span a new thread and allows to return control to the main thread at least partially so the blocking stops breaking the persistent websockets connection the main event loop needs to maintain.

Cheers P.

vanous avatar Jan 29 '18 16:01 vanous