Let an IRC relay finish its queue read when its connection ends (closes #205) #206

Merged
clawbot merged 1 commits from issue-205-kill-quit into next 2026-10-27 10:20:10 +01:00
+6 -2
View File
@@ -32,8 +32,12 @@ func (c *Conn) relayMessages(ctx context.Context) {
// still signals waitCh.
waitCh := c.brk.Wait(c.sessionID)
// Drain any available messages.
delivered := c.drainQueue(ctx)
// Drain any available messages. The drain ignores the
// cancel that comes when the connection ends, because a
// query cancelled while it runs leaves the SQLite
// connection marked broken, and the pool closes it. The
// loop still stops on ctx.
delivered := c.drainQueue(context.WithoutCancel(ctx))
if delivered {
c.brk.Remove(c.sessionID, waitCh)