git » sdk » commit 790849e

Schedule ping for future when sending ping

author Stephen Paul Weber
2026-10-07 13:37:58 UTC
committer Stephen Paul Weber
2026-10-07 13:37:58 UTC
parent ad908f0492bda379d4efa82baf835388299aa4a9

Schedule ping for future when sending ping

Otherwise if we call pingDueBy again right away (eg in response to
sending the ping stanza, etc) we won't ping the same thing again right away.

borogove/ChannelPinger.hx +4 -1

diff --git a/borogove/ChannelPinger.hx b/borogove/ChannelPinger.hx
index 6eb7b05..5960175 100644
--- a/borogove/ChannelPinger.hx
+++ b/borogove/ChannelPinger.hx
@@ -65,7 +65,10 @@ class ChannelPinger {
 	private function pingDueBy(cutoff: Float): Void {
 		final due = getDueBy(cutoff);
 
-		for (scheduled in due) scheduled.channel.selfPing(false);
+		for (scheduled in due) {
+			schedule(scheduled.channel); // Don't ping again right away
+			scheduled.channel.selfPing(false);
+		}
 	}
 
 	private function getDueBy(cutoff: Float): Array<ScheduledChannel> {