rougeth / bottery

[DEVELOPMENT-HALTED] :battery: A bot framework with batteries included
MIT License
344 stars 51 forks source link

Catch KeyboardInterrupt on app.run() and close session and loop #88

Closed rougeth closed 7 years ago

rougeth commented 7 years ago

https://github.com/rougeth/bottery/blob/master/bottery/cli.py#L52-L57

Kalaborative commented 7 years ago

Hi,

close session and loop

By this do you mean, restart the app.run() session? Just making sure. Thanks!

guidiego commented 7 years ago

@Kalaborative I think that he wants something like use .close method from asyncion.Event and aiohttp.Session. I wrote this code right now in bottery.app:

    def close(self):
        logger.debug('Closing session and loop events')
        self._session.close()
        self.loop.close()
rougeth commented 7 years ago

Yep, that is it @guidiego, session without _ and calling this new method on bottery.cli.run after catching KeyboardInterrupt exception.

rougeth commented 7 years ago

@Kalaborative just remember to test it :)

guidiego commented 7 years ago

@rougeth could I handle that one? Or prefer waiting a couple of days?

rougeth commented 7 years ago

@guidiego nooo, go ahead my friend :)