fix weird startup issue
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 13s
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 13s
This commit is contained in:
parent
9b6b3e9027
commit
d24dc99a8e
1 changed files with 6 additions and 5 deletions
11
src/main.py
11
src/main.py
|
@ -112,10 +112,11 @@ for logger in CONFIG["logging"].get("suppress", []):
|
|||
|
||||
class Client(commands.Bot):
|
||||
def __init_(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.web: typing.Optional[asyncio.Task] = None
|
||||
self.web = None
|
||||
self.uptime_thread = None
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
async def _webhook_reader(self):
|
||||
await self.wait_until_ready()
|
||||
fifo = CONFIG["jimmy"].get("fifo")
|
||||
|
@ -241,17 +242,17 @@ class Client(commands.Bot):
|
|||
)
|
||||
self.uptime_thread.start()
|
||||
if CONFIG["jimmy"].get("fifo"):
|
||||
if self.web:
|
||||
if getattr(self, "web", None):
|
||||
self.web.cancel()
|
||||
self.web = None
|
||||
self.web = asyncio.create_task(self._webhook_reader())
|
||||
await super().start(token, reconnect=reconnect)
|
||||
|
||||
async def close(self) -> None:
|
||||
if self.uptime_thread:
|
||||
if getattr(self, "uptime_thread", None):
|
||||
self.uptime_thread.kill.set()
|
||||
await asyncio.get_event_loop().run_in_executor(None, self.uptime_thread.join)
|
||||
if self.web:
|
||||
if getattr(self, "web", None):
|
||||
self.web.cancel()
|
||||
await super().close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue