Skip to content

Commit

Permalink
fix static check
Browse files Browse the repository at this point in the history
Signed-off-by: 高强 <[email protected]>
  • Loading branch information
NUCsimple authored and 高强 committed Jan 10, 2021
1 parent 974ed74 commit 5144b1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions pkg/scalers/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/mongo/readpref"
Expand Down Expand Up @@ -71,10 +70,6 @@ const (
defaultQueryValue = 1
)

type mongoDBFields struct {
ID primitive.ObjectID `bson:"_id, omitempty"`
}

var mongoDBLog = logf.Log.WithName("mongoDB_scaler")

// NewMongoDBScaler creates a new mongoDB scaler
Expand Down Expand Up @@ -231,13 +226,13 @@ func (s *mongoDBScaler) getQueryResult() (int, error) {
return 0, err
}

docs_num, err := s.client.Database(s.metadata.dbName).Collection(s.metadata.collection).CountDocuments(ctx, filter)
docsNum, err := s.client.Database(s.metadata.dbName).Collection(s.metadata.collection).CountDocuments(ctx, filter)
if err != nil {
mongoDBLog.Error(err, fmt.Sprintf("failed to query %v in %v,because of %v", s.metadata.dbName, s.metadata.collection, err))
return 0, err
}

return int(docs_num), nil
return int(docsNum), nil
}

// GetMetrics query from mongoDB,and return to external metrics
Expand Down
2 changes: 1 addition & 1 deletion tests/scalers/mongodb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,4 @@ metadata:
type: Opaque
data:
connect: {{MONGODB_CONNECTION_STRING_BASE64}}
`
`

0 comments on commit 5144b1d

Please sign in to comment.