Skip to content

Commit

Permalink
fix(core/search): Fix search query which matches non-conforming cache…
Browse files Browse the repository at this point in the history
… keys (#2209)

Certain cache keys were failing due to Keys.parse() returning null.
Turns out there is no need to parse the cache key and then reconstruct it.
  • Loading branch information
christopherthielen committed Dec 6, 2017
1 parent 623e245 commit e16aa91
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.netflix.spinnaker.clouddriver.aws.search

import com.netflix.spinnaker.cats.cache.Cache
import com.netflix.spinnaker.cats.cache.CacheData
import com.netflix.spinnaker.cats.cache.RelationshipCacheFilter
import com.netflix.spinnaker.clouddriver.aws.data.Keys
import com.netflix.spinnaker.clouddriver.cache.KeyProcessor
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
Expand All @@ -22,16 +20,7 @@ class ServerGroupKeyProcessor implements KeyProcessor {
}

@Override
Boolean exists(String key) {

Map<String, String> parsed = Keys.parse(key)
String account = parsed['account']
String region = parsed['region']
String name = parsed['serverGroup']

String serverGroupKey = Keys.getServerGroupKey(name, account, region)
CacheData serverGroupData = cacheView.get(SERVER_GROUPS.ns, serverGroupKey, RelationshipCacheFilter.none())

return serverGroupData != null;
Boolean exists(String serverGroupKey) {
return cacheView.get(SERVER_GROUPS.ns, serverGroupKey, RelationshipCacheFilter.none()) != null
}
}

0 comments on commit e16aa91

Please sign in to comment.