Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
fix slow response: remove batchSize options
Browse files Browse the repository at this point in the history
  • Loading branch information
g0rbe committed Jul 19, 2023
1 parent 04fe093 commit 1effae8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions db/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/elmasy-com/slices"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo/options"
)

// Lookup query the DB and returns a list subdomains only.
Expand Down Expand Up @@ -52,7 +51,7 @@ func Lookup(d string, days int) ([]string, error) {
}

// Use Find() to find every shard of the domain
cursor, err := Domains.Find(context.TODO(), doc, options.Find().SetBatchSize(100))
cursor, err := Domains.Find(context.TODO(), doc)
if err != nil {
return nil, fmt.Errorf("failed to find: %s", err)
}
Expand Down Expand Up @@ -118,7 +117,7 @@ func LookupFull(d string, days int) ([]string, error) {
}

// Use Find() to find every shard of the domain
cursor, err := Domains.Find(context.TODO(), doc, options.Find().SetBatchSize(100))
cursor, err := Domains.Find(context.TODO(), doc)
if err != nil {
return nil, fmt.Errorf("failed to find: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion db/records.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func TopListUpdater(wg *sync.WaitGroup) {

start := time.Now()

cursor, err := TopList.Find(context.TODO(), bson.M{}, options.Find().SetBatchSize(10).SetSort(bson.M{"count": -1}))
cursor, err := TopList.Find(context.TODO(), bson.M{}, options.Find().SetSort(bson.M{"count": -1}))
if err != nil {
fmt.Fprintf(os.Stderr, "TopListUpdater() failed to find toplist: %s\n", err)
continue
Expand Down

0 comments on commit 1effae8

Please sign in to comment.