Skip to content

Commit

Permalink
Fix panic in Pipeline when PgConn is busy or closed
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfowler authored and jackc committed Dec 23, 2023
1 parent 603c8c1 commit dfd1980
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pgconn/pgconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,13 @@ func (p *Pipeline) Flush() error {

// Sync establishes a synchronization point and flushes the queued requests.
func (p *Pipeline) Sync() error {
if p.closed {
if p.err != nil {
return p.err
}
return errors.New("pipeline closed")
}

p.conn.frontend.SendSync(&pgproto3.Sync{})
err := p.Flush()
if err != nil {
Expand Down

0 comments on commit dfd1980

Please sign in to comment.