mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix(region): add rows.Close func
This commit is contained in:
@@ -249,6 +249,7 @@ func (self *SNatGateway) PerformSnatResources(ctx context.Context, userCred mccl
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "fetch resource with natgateway_id %s error", self.Id)
|
||||
}
|
||||
defer rows.Close()
|
||||
ipset, ip := make(map[string]struct{}), ""
|
||||
networks, network := make([]string, 0), ""
|
||||
for rows.Next() {
|
||||
@@ -297,6 +298,7 @@ func (self *SNatGateway) extractEipAddr(q *sqlchemy.SQuery) ([]string, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "fetch resource with natgateway_id %s error", self.Id)
|
||||
}
|
||||
defer rows.Close()
|
||||
ipset, ip := make(map[string]struct{}), ""
|
||||
for rows.Next() {
|
||||
err := rows.Scan(&ip)
|
||||
|
||||
@@ -53,6 +53,7 @@ func (man *SGuestnetworkManager) allocMappedIpAddr(ctx context.Context) (string,
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
if err := rows.Scan(&ip); err != nil {
|
||||
return "", errors.Wrap(err, "scan guest mapped ip")
|
||||
@@ -90,6 +91,7 @@ func (man *SHostManager) allocOvnMappedIpAddr(ctx context.Context) (string, erro
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
if err := rows.Scan(&ip); err != nil {
|
||||
return "", errors.Wrap(err, "scan host mapped ip")
|
||||
|
||||
@@ -476,6 +476,7 @@ func zoneUsableVpc(usableVpc bool, query *api.ZoneListInput) (map[string]map[str
|
||||
|
||||
results[id] = map[string]string{"id": id, "cloudregion_id": cloudregion_id}
|
||||
}
|
||||
rows.Close()
|
||||
}
|
||||
|
||||
return results, nil
|
||||
@@ -541,6 +542,7 @@ func filterResult(q *sqlchemy.SQuery) ([]string, error) {
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
return nil, errors.Wrap(err, "filterResult.rows")
|
||||
}
|
||||
defer rows.Close()
|
||||
results := make([]string, 0)
|
||||
for rows.Next() {
|
||||
var id string
|
||||
|
||||
Reference in New Issue
Block a user