revert(bot): ⏪ Remove heartbeat system.

This commit is contained in:
Nyeki.py
2024-10-27 00:19:40 -03:00
parent aa445fbf63
commit 29204f5985
2 changed files with 14 additions and 37 deletions
-16
View File
@@ -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: