revert(bot): ⏪ Remove heartbeat system.
This commit is contained in:
@@ -42,14 +42,6 @@ class Payphone(commands.AutoShardedBot):
|
||||
`shutdown`.
|
||||
"""
|
||||
|
||||
heartbeat: managers.ValueProxy[int]
|
||||
"""A value proxy that connects with the main process.
|
||||
|
||||
It's a timestamp, updated every second and checked by the main process every 5 seconds. If the
|
||||
timestamp hasn't been updated for the past 10 seconds, it means that the process was stuck, so
|
||||
the shard's process is restarted.
|
||||
"""
|
||||
|
||||
redis: aredis.Redis = aredis.Redis(host="localhost" if config.IS_DEBUG else "redis")
|
||||
|
||||
def __init__(self) -> None:
|
||||
@@ -69,12 +61,6 @@ class Payphone(commands.AutoShardedBot):
|
||||
owner_ids=[898569996949676052, 777338793803513886],
|
||||
)
|
||||
|
||||
@tasks.loop(seconds=5)
|
||||
async def update_heartbeat(self) -> None:
|
||||
"""Updates the heartbeat timestamp."""
|
||||
|
||||
self.heartbeat.value = int(datetime.now(timezone.utc).timestamp())
|
||||
|
||||
async def on_ready(self) -> None:
|
||||
"""Initializes the bot.
|
||||
|
||||
@@ -86,8 +72,6 @@ class Payphone(commands.AutoShardedBot):
|
||||
|
||||
await self.redis.ping()
|
||||
|
||||
self.update_heartbeat.start()
|
||||
|
||||
print(f"Ready! Logged in as {self.user.display_name}.")
|
||||
|
||||
async def on_shard_ready(self, shard_id: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user