Bug fix: no running loop, need to create a new one.
This commit is contained in:
@@ -11,7 +11,7 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.8.0"
|
__version__ = "2.8.1"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
|
|||||||
@@ -3469,14 +3469,16 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject):
|
|||||||
bot.setup()
|
bot.setup()
|
||||||
asyncio.ensure_future(cls.start_app())
|
asyncio.ensure_future(cls.start_app())
|
||||||
try:
|
try:
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
logging.info("Stopped by KeyboardInterrupt")
|
logging.info("Stopped by KeyboardInterrupt")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"{e}", exc_info=True)
|
logging.error(f"{e}", exc_info=True)
|
||||||
finally:
|
finally:
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
loop.run_until_complete(cls.stop_app())
|
loop.run_until_complete(cls.stop_app())
|
||||||
return cls.final_state
|
return cls.final_state
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user