fix(bot): 🐛 Make heartbeat update delay toleration longer.
This commit is contained in:
+1
-1
@@ -451,7 +451,7 @@ class Payphone(commands.AutoShardedBot):
|
|||||||
return discord.EmbedAuthor(
|
return discord.EmbedAuthor(
|
||||||
name=self.user.display_name, icon_url=self.user.display_avatar.url
|
name=self.user.display_name, icon_url=self.user.display_avatar.url
|
||||||
)
|
)
|
||||||
|
|
||||||
@tasks.loop(seconds=1)
|
@tasks.loop(seconds=1)
|
||||||
async def update_heartbeat(self) -> None:
|
async def update_heartbeat(self) -> None:
|
||||||
"""Updates the heartbeat timestamp."""
|
"""Updates the heartbeat timestamp."""
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ if __name__ == "__main__":
|
|||||||
shutdown = manager.Value("b", False)
|
shutdown = manager.Value("b", False)
|
||||||
scheduled_shutdown = manager.Value("b", False)
|
scheduled_shutdown = manager.Value("b", False)
|
||||||
heartbeats = [
|
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 ""}.")
|
print(f"Starting {shard_count} shard{"s" if shard_count != 1 else ""}.")
|
||||||
@@ -148,7 +148,7 @@ if __name__ == "__main__":
|
|||||||
raise ShutdownException()
|
raise ShutdownException()
|
||||||
|
|
||||||
for i in range(shard_count):
|
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() or not is_heartbeat_updated:
|
||||||
if not ps[i].is_alive():
|
if not ps[i].is_alive():
|
||||||
|
|||||||
Reference in New Issue
Block a user