@@ -18,19 +18,19 @@ import (
1818// MongoDB collection.
1919type lastCommunicationsRepo structuredmongo.Repository
2020
21- func (r * lastCommunicationsRepo ) RecordReceivedDeviceData (ctx context.Context ,
21+ func (l * lastCommunicationsRepo ) RecordReceivedDeviceData (ctx context.Context ,
2222 lastComm alerts.LastCommunication ) error {
2323
2424 opts := options .Update ().SetUpsert (true )
25- _ , err := r .UpdateOne (ctx , r .filter (lastComm ), bson.M {"$set" : lastComm }, opts )
25+ _ , err := l .UpdateOne (ctx , l .filter (lastComm ), bson.M {"$set" : lastComm }, opts )
2626 if err != nil {
2727 return fmt .Errorf ("upserting alerts.LastCommunication: %w" , err )
2828 }
2929 return nil
3030}
3131
32- func (r * lastCommunicationsRepo ) EnsureIndexes () error {
33- repo := structuredmongo .Repository (* r )
32+ func (l * lastCommunicationsRepo ) EnsureIndexes () error {
33+ repo := structuredmongo .Repository (* l )
3434 return (& repo ).CreateAllIndexes (context .Background (), []mongo.IndexModel {
3535 {
3636 Keys : bson.D {
@@ -50,22 +50,22 @@ func (r *lastCommunicationsRepo) EnsureIndexes() error {
5050 })
5151}
5252
53- func (r * lastCommunicationsRepo ) filter (lastComm alerts.LastCommunication ) map [string ]any {
53+ func (l * lastCommunicationsRepo ) filter (lastComm alerts.LastCommunication ) map [string ]any {
5454 return map [string ]any {
5555 "userId" : lastComm .UserID ,
5656 "dataSetId" : lastComm .DataSetID ,
5757 }
5858}
5959
60- func (r * lastCommunicationsRepo ) OverdueCommunications (ctx context.Context ) (
60+ func (l * lastCommunicationsRepo ) OverdueCommunications (ctx context.Context ) (
6161 []alerts.LastCommunication , error ) {
6262
6363 start := time .Now ().Add (- alerts .MinimumNoCommunicationDelay )
6464 selector := bson.M {
6565 "lastReceivedDeviceData" : bson.M {"$lte" : start },
6666 }
6767 findOptions := options .Find ().SetSort (bson.D {{Key : "lastReceivedDeviceData" , Value : 1 }})
68- cursor , err := r .Find (ctx , selector , findOptions )
68+ cursor , err := l .Find (ctx , selector , findOptions )
6969 if err != nil {
7070 return nil , errors .Wrapf (err , "Unable to list overdue records" )
7171 }
0 commit comments