git » sdk » commit 9adae58

Clear ChannelPinger when we reset channels

author Stephen Paul Weber
2026-10-07 13:36:22 UTC
committer Stephen Paul Weber
2026-10-07 13:36:22 UTC
parent 1266e8132994607a05a1447e72fe8ee3eaa5f448

Clear ChannelPinger when we reset channels

We don't know what channels we are in and are about to force join them
all, so no reason to waste time sending pings.

borogove/ChannelPinger.hx +4 -0
borogove/Client.hx +3 -0

diff --git a/borogove/ChannelPinger.hx b/borogove/ChannelPinger.hx
index 872f350..6eb7b05 100644
--- a/borogove/ChannelPinger.hx
+++ b/borogove/ChannelPinger.hx
@@ -47,6 +47,10 @@ class ChannelPinger {
 		scheduledChannels.remove(channel.chatId);
 	}
 
+	public function clear(): Void {
+		scheduledChannels.clear();
+	}
+
 	public function pingPastDue(): Void {
 		pingDueBy(now());
 	}
diff --git a/borogove/Client.hx b/borogove/Client.hx
index 9add294..6caec6a 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -1126,6 +1126,8 @@ class Client extends EventEmitter {
 			return EventHandled;
 		}
 
+		channelPinger.clear();
+
 		// We don't know what any presences are
 		persistence.clearMemberPresence(accountId(), null);
 		for (chat in chats) {
@@ -2546,6 +2548,7 @@ class Client extends EventEmitter {
 	}
 
 	private function joinAllChannels() {
+		channelPinger.clear();
 		for (channel in getChannels()) {
 			if (channel.disco.identities.length < 1) {
 				channel.refreshDisco(() -> {