pgdriver: discarding bad listener connection #594
-
|
When running something similar to this, sometimes I notice: Two questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
That error happens when you can't consume all messages from the Listener channel fast enough. Probably the consuming loop crashed or is blocked for too long. |
Beta Was this translation helpful? Give feedback.
-
|
I got a stable reproduction of the error. Change this lines: https://github.com/uptrace/bun/blob/master/example/pg-listen/main.go#L41-L43 To above: // if err := ln.Listen(ctx, "mychan1", "mychan2"); err != nil {
// panic(err)
// }
for {
select {
case notif := <-ln.Channel():
fmt.Println(notif.Channel, notif.Payload)
}
}
|
Beta Was this translation helpful? Give feedback.
-
|
I also caught this error. In my case, code looks like: But And correct code looks like: I think its not correct. I think 2nd way cant be done, bc it is necessary to support creating multiple listening channels from a single listener. I suggest renaming the method for creating the channel to |
Beta Was this translation helpful? Give feedback.

That error happens when you can't consume all messages from the Listener channel fast enough. Probably the consuming loop crashed or is blocked for too long.