close resultset earlier in scheduler

This commit is contained in:
Andre Medeiros 2023-03-24 17:05:00 -04:00
parent 568ed6f51c
commit 782f77a7c4
1 changed files with 2 additions and 1 deletions

View File

@ -474,7 +474,6 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
logger.Error("failed to fetch accounts", zap.Error(err))
return
}
defer rows.Close()
var ids []string
for rows.Next() {
@ -482,6 +481,8 @@ func enqueueAccounts(ctx context.Context, logger *zap.Logger, statsd *statsd.Cli
_ = rows.Scan(&id)
ids = append(ids, id)
}
// Use this instead of deferring as we're going to take a while to get out of this method.
rows.Close()
chunks := [][]string{}
chunkSize := int(math.Ceil(float64(len(ids)) / float64(accountEnqueueSeconds)))