mirror of
https://github.com/jackc/pgx.git
synced 2025-05-07 16:12:08 +00:00
Fix panic in Pipeline when PgConn is busy or closed
This commit is contained in:
parent
603c8c1e90
commit
dfd198003a
@ -2053,6 +2053,13 @@ func (p *Pipeline) Flush() error {
|
|||||||
|
|
||||||
// Sync establishes a synchronization point and flushes the queued requests.
|
// Sync establishes a synchronization point and flushes the queued requests.
|
||||||
func (p *Pipeline) Sync() error {
|
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{})
|
p.conn.frontend.SendSync(&pgproto3.Sync{})
|
||||||
err := p.Flush()
|
err := p.Flush()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user