Skip to content

Commit

Permalink
refactor: don't begin status checks until ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Skelmis committed Nov 2, 2022
1 parent c454aca commit fc6814b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion suggestions/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(self, *args, **kwargs):
self.total_shards: int = kwargs.get("shard_count", 0)

self._has_dispatched_initial_ready: bool = False
self._initial_ready_future: asyncio.Future = asyncio.Future()

async def get_or_fetch_channel(self, channel_id: int):
try:
Expand All @@ -103,6 +104,7 @@ async def dispatch_initial_ready(self):
return

self._has_dispatched_initial_ready = True
self._initial_ready_future.set_result(None)
log.info("Suggestions main: Ready")
log.info("Startup took: %s", self.get_uptime())
await self.suggestion_emojis.populate_emojis()
Expand Down Expand Up @@ -575,7 +577,7 @@ async def push_status(self):
return

async def inner():
await self.wait_until_ready()
await self._initial_ready_future
patch = os.environ["UPTIME_PATCH"]
while not self.state.is_closing:
appears_down = False
Expand Down

0 comments on commit fc6814b

Please sign in to comment.