Skip to content

Commit

Permalink
Merge pull request #13 from akkuman/fix-dedup
Browse files Browse the repository at this point in the history
fix: disable dedup when the dedup field is not set
  • Loading branch information
tikazyq authored Jun 7, 2024
2 parents cbbd895 + 86feb8c commit 0f6cd4e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions result/service_mongo.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package result

import (
"time"

"github.com/crawlab-team/crawlab-core/constants"
"github.com/crawlab-team/crawlab-core/interfaces"
"github.com/crawlab-team/crawlab-core/models/models"
Expand All @@ -13,7 +15,6 @@ import (
"go.mongodb.org/mongo-driver/bson/primitive"
mongo2 "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"time"
)

type ServiceMongo struct {
Expand All @@ -39,7 +40,7 @@ func (svc *ServiceMongo) Count(query generic.ListQuery) (n int, err error) {
}

func (svc *ServiceMongo) Insert(docs ...interface{}) (err error) {
if svc.dc.Dedup.Enabled {
if svc.dc.Dedup.Enabled && len(svc.dc.Dedup.Keys) > 0 {
for _, doc := range docs {
hash, err := utils.GetResultHash(doc, svc.dc.Dedup.Keys)
if err != nil {
Expand Down

0 comments on commit 0f6cd4e

Please sign in to comment.