From 58e1426eca69301cfa9304c1ed7f5bea51b4a69a Mon Sep 17 00:00:00 2001 From: Guy Baron Date: Sat, 22 Jun 2019 12:03:37 +0300 Subject: [PATCH] closing rows when querying transactional outbox fails When failing to query the outbox tables there was no call to rows.Close potentially causing a connection leack. --- gbus/tx/mysql/txoutbox.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gbus/tx/mysql/txoutbox.go b/gbus/tx/mysql/txoutbox.go index 7bc8108..683450f 100644 --- a/gbus/tx/mysql/txoutbox.go +++ b/gbus/tx/mysql/txoutbox.go @@ -241,7 +241,10 @@ func (outbox *TxOutbox) sendMessages(recordSelector func(tx *sql.Tx) (*sql.Rows, if selectErr != nil { outbox.log().WithError(selectErr).Error("failed fetching messages from outbox") - + err := rows.Close() + if err != nil { + outbox.log().WithError(err).Error("could not close Rows") + } return selectErr }