close session immediately

This commit is contained in:
techknowlogick 2024-10-08 12:29:47 -04:00 committed by GitHub
parent d55e25ff4d
commit d9efbf30ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -185,11 +185,11 @@ func (opts *SearchBadgeOptions) ToJoins() []db.JoinFunc {
func SearchBadges(ctx context.Context, opts *SearchBadgeOptions) (badges []*Badge, _ int64, _ error) {
sessCount := opts.toSearchQueryBase(ctx)
defer sessCount.Close()
count, err := sessCount.Count(new(Badge))
if err != nil {
return nil, 0, fmt.Errorf("count: %w", err)
}
sessCount.Close()
if len(opts.OrderBy) == 0 {
opts.OrderBy = db.SearchOrderByID