Skip to content

Commit 64c6cb1

Browse files
authored
Fix ns id cache (#43)
Stop cacheing empty namespace ID if found in Cloud Map, and cache all namespaces in account. Continue to cache empty ID if not found to prevent throttling for non-imported services.
1 parent 560eedb commit 64c6cb1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/cloudmap/client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,14 @@ func (sdc *serviceDiscoveryClient) getNamespaceId(ctx context.Context, nsName st
249249
}
250250

251251
for _, ns := range namespaces {
252-
sdc.cacheNamespaceId(nsName, nsId)
252+
sdc.cacheNamespaceId(ns.Name, ns.Id)
253253
if nsName == ns.Name {
254254
nsId = ns.Id
255255
}
256256
}
257257

258+
// This will cache empty namespace IDs for namespaces not in Cloud Map
259+
sdc.cacheNamespaceId(nsName, nsId)
258260
return nsId, nil
259261
}
260262

0 commit comments

Comments
 (0)