Let an IRC relay finish its queue read when its connection ends (closes #205) #206
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user