Skip to content

Commit b35be04

Browse files
Copilotthatmattlong
andcommitted
Replace string with ncVersionInfo struct for outdated NC tracking
Co-authored-by: thatmattlong <[email protected]>
1 parent c39e7f2 commit b35be04

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

cns/restserver/internalapi.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ import (
2929
// internal APIs (definde in internalapi.go).
3030
// This will be used internally (say by RequestController in case of AKS)
3131

32+
// ncVersionInfo holds expected and actual version information for an NC
33+
type ncVersionInfo struct {
34+
expected string
35+
actual string
36+
}
37+
3238
// GetPartitionKey - Get dnc/service partition key
3339
func (service *HTTPRestService) GetPartitionKey() (dncPartitionKey string) {
3440
service.RLock()
@@ -228,8 +234,8 @@ func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMo
228234
hasNC.Set(float64(len(nmaNCs)))
229235

230236
// Track NCs missing from NMAgent response and outdated NCs for better error reporting
231-
missingNCs := make(map[string]string) // ncID -> expected version
232-
outdatedNMaNCs := make(map[string]string) // ncID -> "expected:actual" version info
237+
missingNCs := make(map[string]string) // ncID -> expected version
238+
outdatedNMaNCs := make(map[string]ncVersionInfo) // ncID -> version info with expected and actual
233239

234240
for ncID := range outdatedNCs {
235241
nmaNCVersionStr, ok := nmaNCs[ncID]
@@ -276,7 +282,10 @@ func (service *HTTPRestService) syncHostNCVersion(ctx context.Context, channelMo
276282

277283
// Check if NMAgent version is still outdated compared to expected DNC version
278284
if nmaNCVersion < expectedVersionInt {
279-
outdatedNMaNCs[ncID] = fmt.Sprintf("expected:%s,actual:%s", expectedVersion, nmaNCVersionStr)
285+
outdatedNMaNCs[ncID] = ncVersionInfo{
286+
expected: expectedVersion,
287+
actual: nmaNCVersionStr,
288+
}
280289
continue
281290
}
282291

0 commit comments

Comments
 (0)