From 735a9dc1d2363f483159a673bccc48e9148fb569 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 8 May 2026 22:21:27 +0000 Subject: [PATCH] Properly close rows on empty results I we don't do this we get "conn busy" errors. --- db/connection.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/db/connection.go b/db/connection.go index b7344413..d0397aa3 100644 --- a/db/connection.go +++ b/db/connection.go @@ -44,14 +44,22 @@ func ExecuteNone(ctx context.Context, stmt postgres.Statement) error { func ExecuteNoneTx(ctx context.Context, txn Ex, stmt postgres.Statement) error { query, args := stmt.Sql() - _, err := txn.Query(ctx, query, args...) - return err + r, err := txn.Query(ctx, query, args...) + if err != nil { + return fmt.Errorf("query: %w", err) + } + r.Close() + return nil } func ExecuteNoneTxBob(ctx context.Context, txn bob.Tx, stmt postgres.Statement) error { query, args := stmt.Sql() - _, err := txn.QueryContext(ctx, query, args...) - return err + r, err := txn.QueryContext(ctx, query, args...) + if err != nil { + return fmt.Errorf("query: %w", err) + } + r.Close() + return nil } func ExecuteOne[T any](ctx context.Context, stmt postgres.Statement) (T, error) { query, args := stmt.Sql()