Skip to content

Commit

Permalink
expand floating registry logs (networkservicemesh#2162)
Browse files Browse the repository at this point in the history
Signed-off-by: denis-tingajkin <[email protected]>
  • Loading branch information
denis-tingaikin authored Jun 1, 2020
1 parent c1b1959 commit 921b30c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion applications/nsmrs/pkg/serviceregistryserver/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (rc *nseRegistryCache) AddNetworkServiceEndpoint(entry *registry.NSERegistr
}

func (rc *nseRegistryCache) addNetworkServiceEndpoint(entry *registry.NSERegistration) (*registry.NSERegistration, error) {
logrus.Infof("Start adding network service endpoint %v", entry)
if endpoint, ok := rc.endpoints[entry.NetworkServiceEndpoint.Name]; ok {
return nil, errors.Errorf("network service endpoint with name %s already exists: old: %v; new: %v", endpoint.NetworkServiceEndpoint.Name, endpoint, entry)
}
Expand Down Expand Up @@ -104,7 +105,10 @@ func (rc *nseRegistryCache) UpdateNetworkServiceEndpoint(nse *registry.NSERegist
if endpoint.NetworkServiceManager.Name != nse.NetworkServiceManager.Name {
return nil, errors.Errorf("network service endpoint with name %s already registered from different NSM: old: %v; new: %v", endpoint.NetworkServiceEndpoint.Name, endpoint, nse)
}
endpoint.NetworkServiceManager.ExpirationTime = &timestamp.Timestamp{Seconds: time.Now().Add(rc.nseExpirationTimeout).Unix()}
before := endpoint.NetworkServiceManager.ExpirationTime
after := &timestamp.Timestamp{Seconds: time.Now().Add(rc.nseExpirationTimeout).Unix()}
endpoint.NetworkServiceManager.ExpirationTime = after
logrus.Infof("Updated expiration time %v -> %v for entry %v.", before, after, endpoint)
return endpoint, nil
}

Expand Down Expand Up @@ -146,6 +150,7 @@ func StartNSMDTracking(ctx context.Context, rc *nseRegistryCache) {
rc.RLock()
var endpoints = map[string]*registry.NSERegistration{}
for endpointName, endpoint := range rc.endpoints {
logrus.Infof("Preparing endpoint: %v", endpoint)
endpoints[endpointName] = endpoint
}
rc.RUnlock()
Expand Down

0 comments on commit 921b30c

Please sign in to comment.