Skip to content

Commit

Permalink
Revert "[-] fix pool after release handler to avoid session terminati…
Browse files Browse the repository at this point in the history
…on causing side effects (cybertec-postgresql#615)"

This reverts commit e483cf5.
  • Loading branch information
lorenzo committed Oct 21, 2024
1 parent d1c51ef commit 7c21dc8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 0 additions & 1 deletion internal/migrator/migrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func migrateTest() error {
if err != nil {
return err
}
defer pge.Finalize()
_, _ = pge.ConfigDb.Exec(ctx, "DROP TABLE IF EXISTS foo, bar, baz, migration")
db, err := pge.ConfigDb.Acquire(ctx)
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions internal/pgengine/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,10 @@ func (pge *PgEngine) getPgxConnConfig() *pgxpool.Config {
// some objects and/or setting changes will still exist in the session
connConfig.AfterRelease = func(pgconn *pgx.Conn) bool {
var err error
if pgconn.DeallocateAll(context.Background()) != nil {
return false // destroy the connection in case of error
}
if _, err = pgconn.Exec(context.Background(), "DISCARD ALL"); err == nil {
_, err = pgconn.Exec(context.Background(), "LISTEN "+quoteIdent(pge.ClientName))
}
return err == nil
return err != nil
}

if !pge.Start.Debug { //will handle notification in HandleNotifications directly
Expand Down

0 comments on commit 7c21dc8

Please sign in to comment.