@@ -251,8 +251,8 @@ func BuildManager(
251
251
}()
252
252
}
253
253
254
- am .integratedPeerValidator .SetPeerInvalidationListener (func (accountID string ) {
255
- am .onPeersInvalidated (ctx , accountID )
254
+ am .integratedPeerValidator .SetPeerInvalidationListener (func (accountID string , peerIDs [] string ) {
255
+ am .onPeersInvalidated (ctx , accountID , peerIDs )
256
256
})
257
257
258
258
return am , nil
@@ -1719,9 +1719,27 @@ func (am *DefaultAccountManager) GetDNSDomain(settings *types.Settings) string {
1719
1719
return settings .DNSDomain
1720
1720
}
1721
1721
1722
- func (am * DefaultAccountManager ) onPeersInvalidated (ctx context.Context , accountID string ) {
1723
- log .WithContext (ctx ).Debugf ("validated peers has been invalidated for account %s" , accountID )
1724
- am .BufferUpdateAccountPeers (ctx , accountID )
1722
+ func (am * DefaultAccountManager ) onPeersInvalidated (ctx context.Context , accountID string , peerIDs []string ) {
1723
+ peers := []* nbpeer.Peer {}
1724
+ log .WithContext (ctx ).Debugf ("invalidating peers %v for account %s" , peerIDs , accountID )
1725
+ for _ , peerID := range peerIDs {
1726
+ peer , err := am .GetPeer (ctx , accountID , peerID , activity .SystemInitiator )
1727
+ if err != nil {
1728
+ log .WithContext (ctx ).Errorf ("failed to get invalidated peer %s for account %s: %v" , peerID , accountID , err )
1729
+ continue
1730
+ }
1731
+ peers = append (peers , peer )
1732
+ }
1733
+ if len (peers ) > 0 {
1734
+ err := am .expireAndUpdatePeers (ctx , accountID , peers )
1735
+ if err != nil {
1736
+ log .WithContext (ctx ).Errorf ("failed to expire and update invalidated peers for account %s: %v" , accountID , err )
1737
+ return
1738
+ }
1739
+ } else {
1740
+ log .WithContext (ctx ).Debugf ("running invalidation with no invalid peers" )
1741
+ }
1742
+ log .WithContext (ctx ).Debugf ("invalidated peers have been expired for account %s" , accountID )
1725
1743
}
1726
1744
1727
1745
func (am * DefaultAccountManager ) FindExistingPostureCheck (accountID string , checks * posture.ChecksDefinition ) (* posture.Checks , error ) {
0 commit comments