Skip to content

Commit

Permalink
fix context.TODO()
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohan460 committed Oct 21, 2022
1 parent 41b47ef commit 96e93e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions storage/mongodb/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ func (m MongoDBStorage) RetrievePushInfo(ctx context.Context, ids []string) (map
"$in": ids,
},
}
cursor, err := m.CheckinCollection.Find(context.TODO(), filter)
cursor, err := m.CheckinCollection.Find(ctx, filter)
if err != nil {
return nil, err
}

records := []DeviceCheckinRecord{}
err = cursor.All(context.TODO(), &records)
err = cursor.All(ctx, &records)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions storage/mongodb/pushcert.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (m MongoDBStorage) IsPushCertStale(ctx context.Context, topic string, stale
"topic": topic,
}
res := PushCertRecord{}
err := m.PushCertCollection.FindOne(context.TODO(), filter, options.FindOne().SetSort(latestSort)).Decode(&res)
err := m.PushCertCollection.FindOne(ctx, filter, options.FindOne().SetSort(latestSort)).Decode(&res)
if err != nil {
return false, err
}
Expand All @@ -39,7 +39,7 @@ func (m MongoDBStorage) RetrievePushCert(ctx context.Context, topic string) (cer
"topic": topic,
}
res := PushCertRecord{}
err = m.PushCertCollection.FindOne(context.TODO(), filter, options.FindOne().SetSort(latestSort)).Decode(&res)
err = m.PushCertCollection.FindOne(ctx, filter, options.FindOne().SetSort(latestSort)).Decode(&res)
if err != nil {
return nil, "", err
}
Expand All @@ -58,7 +58,7 @@ func (m MongoDBStorage) StorePushCert(ctx context.Context, pemCert, pemKey []byt
return err
}

_, err = m.PushCertCollection.InsertOne(context.TODO(), PushCertRecord{
_, err = m.PushCertCollection.InsertOne(ctx, PushCertRecord{
Timestamp: strconv.FormatInt(time.Now().UnixNano(), 10),
Certificate: string(pemCert),
PrivateKey: string(pemKey),
Expand Down

0 comments on commit 96e93e5

Please sign in to comment.