@@ -18,28 +18,28 @@ func (r *repo) SaveOwnMetadata(_ context.Context, locality string, publicEndpoin
1818 return stacktrace .NewErrorWithCode (dsserr .BadRequest , "Public endpoint not set" )
1919 }
2020
21- r .participants [locality ] = & participant {
22- publicEndpoint : publicEndpoint ,
23- updatedAt : time .Now (),
21+ r .state . Participants [locality ] = & participant {
22+ PublicEndpoint : publicEndpoint ,
23+ UpdatedAt : time .Now (). UTC (),
2424 }
2525 return nil
2626}
2727
2828func (r * repo ) GetDSSMetadata (_ context.Context ) ([]* auxmodels.DSSMetadata , error ) {
29- metadata := make ([]* auxmodels.DSSMetadata , 0 , len (r .participants ))
30- for locality , p := range r .participants {
31- updatedAt := p .updatedAt
29+ metadata := make ([]* auxmodels.DSSMetadata , 0 , len (r .state . Participants ))
30+ for locality , p := range r .state . Participants {
31+ updatedAt := p .UpdatedAt
3232 m := & auxmodels.DSSMetadata {
3333 Locality : locality ,
34- PublicEndpoint : p .publicEndpoint ,
34+ PublicEndpoint : p .PublicEndpoint ,
3535 UpdatedAt : & updatedAt ,
3636 }
3737
3838 // Find the latest heartbeat across all sources for this locality.
3939 var latest auxmodels.Heartbeat
4040 found := false
41- for key , hb := range r .heartbeats {
42- if key .locality != locality {
41+ for key , hb := range r .state . Heartbeats {
42+ if key .Locality != locality {
4343 continue
4444 }
4545 if ! found || hb .Timestamp .After (* latest .Timestamp ) {
@@ -69,15 +69,15 @@ func (r *repo) RecordHeartbeat(_ context.Context, heartbeat auxmodels.Heartbeat)
6969 }
7070
7171 if heartbeat .Timestamp == nil {
72- now := time .Now ()
72+ now := time .Now (). UTC ()
7373 heartbeat .Timestamp = & now
7474 }
7575
7676 if heartbeat .NextHeartbeatExpectedBefore != nil && heartbeat .NextHeartbeatExpectedBefore .Before (* heartbeat .Timestamp ) {
7777 return stacktrace .NewErrorWithCode (dsserr .BadRequest , "Cannot expect the timestamp of the next heartbeat before the timestamp of the new heartbeat" )
7878 }
7979
80- r .heartbeats [heartbeatKey {locality : heartbeat .Locality , source : heartbeat .Source }] = heartbeat
80+ r .state . Heartbeats [heartbeatKey {Locality : heartbeat .Locality , Source : heartbeat .Source }] = heartbeat
8181 return nil
8282}
8383
0 commit comments