-
Notifications
You must be signed in to change notification settings - Fork 474
loop propagation for the underlying session #362
base: master
Are you sure you want to change the base?
Conversation
This is works for:
|
Any chance that this PR will be merged? |
Sorry, I'd say no, mainly because I don't want to take care of one more framework. Thanks for the work though. It's good for telepot to embrace more situations, but I simply don't have the time and motivation to keep up with those concerns. That being said, I appreciate @xen 's work. Thank you. |
@nickoala I think we misunderstood each other. Don't let that I mention Sanic confuse you. My pull request was built around 2 lines of code. Existing code silently create an internal instance of You made the shortcut and it works. But there exists another implementation of the loop by Magicstack Inc. called So I made I think it worth to keep. At least @Belanchuk already found me via telegram to ask is my patch working. |
@xen, after reading over your message a few times, I start to understand what you are trying to get at. I did misunderstand your intention a little bit. Your modification did not seem like it was "built around 2 lines of code"! 😅 First, let me explain my code a little bit. As you are aware, the module Now, what should I do if I want to substitute my own event loop? I would supply my own loop to the Without that function, a workaround may still be possible. According to uvloop's github page, replacing asyncio's default loop with uvloop is easy. How about doing that before loading telepot? For example, import asyncio
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
import telepot.aio
bot = telepot.aio.Bot(...) By not supplying any loop, the I will re-open the PR and see what you have to say ... I also would like to explain a bit why the |
Unfortunately just adding
doesn't work at all. It's very sad because telepot looks like a much stronger solution than aiogram (by the way they also raise the same error). |
Here is my fix for the #359
What have been done here:
loop
object for Bot class and for underlying sessions._pool
. I don't know what is the idea behind, so I reimplemented idea asself.session
. I know that I probably lack some understanding why it has been done this way before.telepot.aio.api
module, but I don't think it is worth to left it since most functions logically are part of theBot
class.I didn't make any additional tests since I'm working on a prototype of my project. It is a very early stage and I try to make pieces together.