Remove the relay's broker wait channel after each tick (closes #151)
check / check (push) Waiting to run

The IRC relay registers a broker wait channel on each pass of its
loop, and when the 100 ms ticker fired instead of a notification it
looped without removing that channel. An idle IRC listener connection
added ten channels a second to the broker, and all but the last stayed
after the connection closed. The ticker case now removes its channel,
as the HTTP long-poll does after its timer.

Broker.ListenerCount returns how many wait channels a user holds, so
the test can check that an idle connection holds at most one, and
none after it closes.

Model: opus-5-5
Co-authored-by: clawbot <sneak+clawbot@sneak.cloud>
This commit was merged in pull request #160.
This commit is contained in:
2026-10-20 18:02:03 +02:00
committed by clawbot
parent 0b09cf838c
commit 5100b9a665
5 changed files with 99 additions and 1 deletions
+4 -1
View File
@@ -42,7 +42,10 @@ func (c *Conn) relayMessages(ctx context.Context) {
case <-waitCh:
// New message notification — loop back.
case <-ticker.C:
// Periodic check.
// Periodic check. Nothing used waitCh, so take it
// out of the broker before the next pass adds
// another.
c.brk.Remove(c.sessionID, waitCh)
case <-ctx.Done():
c.brk.Remove(c.sessionID, waitCh)