Skip to content

Commit

Permalink
suppoert speedtests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagostin committed Jul 13, 2024
1 parent 0d0d8ac commit 57bb304
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/agent/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,17 @@ func (probe *Probe) GetAll(db *mongo.Database) ([]*Probe, error) {
func (probe *Probe) UpdateFirstProbeTarget(db *mongo.Database, targetStatus string) error {
var filter = bson.D{{"_id", probe.ID}}

get, err := probe.Get(db)
if err != nil {
return err
}
get[0].Config.Target[0].Target = targetStatus

update := bson.D{
{"$set", probe},
{"$set", get},
}

_, err := db.Collection("probes").UpdateOne(context.TODO(), filter, update)
_, err = db.Collection("probes").UpdateOne(context.TODO(), filter, update)
if err != nil {
return err
}
Expand Down

0 comments on commit 57bb304

Please sign in to comment.