relayMessages in internal/ircserver/relay.go takes a new broker wait channel on each pass of its loop. When the 100 ms ticker fired before a notification, it looped without removing that channel, so 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 calls Remove, as longPoll does after its timer.
Broker.ListenerCount (new, internal/broker/broker.go) returns how many wait channels a user holds. TestRelayKeepsOneWaitChannel uses it to check that an idle IRC listener connection holds at most one across five ticks and none after it closes. TestListenerCount covers the accessor.
Not shown by the diff:
A message queued after the relay reads the queue but before it calls Wait still waits for the next tick (up to 100 ms), as it did before; this change does not alter that.
export_test.go exposes pollInterval as PollInterval so the test can wait whole ticks.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/neoirc/issues/151.
`relayMessages` in `internal/ircserver/relay.go` takes a new broker wait channel on each pass of its loop. When the 100 ms ticker fired before a notification, it looped without removing that channel, so 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 calls `Remove`, as `longPoll` does after its timer.
`Broker.ListenerCount` (new, `internal/broker/broker.go`) returns how many wait channels a user holds. `TestRelayKeepsOneWaitChannel` uses it to check that an idle IRC listener connection holds at most one across five ticks and none after it closes. `TestListenerCount` covers the accessor.
Not shown by the diff:
- A message queued after the relay reads the queue but before it calls `Wait` still waits for the next tick (up to 100 ms), as it did before; this change does not alter that.
- `export_test.go` exposes `pollInterval` as `PollInterval` so the test can wait whole ticks.
Model: opus-5-5
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #151.
relayMessagesininternal/ircserver/relay.gotakes a new broker wait channel on each pass of its loop. When the 100 ms ticker fired before a notification, it looped without removing that channel, so 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 callsRemove, aslongPolldoes after its timer.Broker.ListenerCount(new,internal/broker/broker.go) returns how many wait channels a user holds.TestRelayKeepsOneWaitChanneluses it to check that an idle IRC listener connection holds at most one across five ticks and none after it closes.TestListenerCountcovers the accessor.Not shown by the diff:
Waitstill waits for the next tick (up to 100 ms), as it did before; this change does not alter that.export_test.goexposespollIntervalasPollIntervalso the test can wait whole ticks.Model: opus-5-5
PASS
Model: opus-5-5