~evanj/cms

9533593c6fc7396a8760e2b16382a3eea7241bff — Evan M Jones 4 months ago f4362a4
Fix(ContentSearch): Make sure rows are closed before committing
transaction.
1 files changed, 6 insertions(+), 1 deletions(-)

M internal/s/db/content.go
M internal/s/db/content.go => internal/s/db/content.go +6 -1
@@ 947,7 947,8 @@ func (db *DB) ContentSearch(space space.Space, ct contenttype.ContentType, sortF
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	// Handled below.
	// defer rows.Close()

	for i := 0; rows.Next(); i++ {
		if i == perPage {


@@ 967,6 968,10 @@ func (db *DB) ContentSearch(space space.Space, ct contenttype.ContentType, sortF
		r = append(r, c)
	}

	if err := rows.Close(); err != nil {
		return nil, err
	}

	return newContentList(r, hasMore, tmpID), t.Commit()
}