Skip to content

Commit

Permalink
fix(region): custom total count (#20998)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito authored Aug 12, 2024
1 parent 33cc444 commit 1d89751
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cloudcommon/db/virtualresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package db

import (
"context"
"database/sql"

"yunion.io/x/jsonutils"
"yunion.io/x/log"
Expand Down Expand Up @@ -118,10 +119,9 @@ func (manager *SVirtualResourceBaseManager) CustomizedTotalCount(ctx context.Con
StatusInfo []apis.StatusStatisticStatusInfo
}{}

var err error
results.Count, err = totalQ.CountWithError()
if err != nil {
return -1, nil, errors.Wrapf(err, "CountWithError")
err := totalQ.First(&results.TotalCountBase)
if err != nil && errors.Cause(err) != sql.ErrNoRows {
return -1, nil, errors.Wrapf(err, "First")
}

totalSQ := totalQ.ResetFields().SubQuery()
Expand Down

0 comments on commit 1d89751

Please sign in to comment.