diff --git a/payphone/bot.py b/payphone/bot.py index 0715fba..cedb7a9 100644 --- a/payphone/bot.py +++ b/payphone/bot.py @@ -451,7 +451,7 @@ class Payphone(commands.AutoShardedBot): return discord.EmbedAuthor( name=self.user.display_name, icon_url=self.user.display_avatar.url ) - + @tasks.loop(seconds=1) async def update_heartbeat(self) -> None: """Updates the heartbeat timestamp.""" diff --git a/run.py b/run.py index bc98131..2b69ca0 100644 --- a/run.py +++ b/run.py @@ -110,7 +110,7 @@ if __name__ == "__main__": shutdown = manager.Value("b", False) scheduled_shutdown = manager.Value("b", False) heartbeats = [ - manager.Value("i", 0) for i in range(shard_count) + manager.Value("i", int(datetime.now(timezone.utc).timestamp())) for i in range(shard_count) ] print(f"Starting {shard_count} shard{"s" if shard_count != 1 else ""}.") @@ -148,7 +148,7 @@ if __name__ == "__main__": raise ShutdownException() for i in range(shard_count): - is_heartbeat_updated = heartbeats[i].value > (datetime.now(timezone.utc) - timedelta(seconds=10)).timestamp() + is_heartbeat_updated = heartbeats[i].value > (datetime.now(timezone.utc) - timedelta(seconds=30)).timestamp() if not ps[i].is_alive() or not is_heartbeat_updated: if not ps[i].is_alive():