Skip to content

Commit

Permalink
fix(titus): "Fix" circular dependency with Provider (#3944)
Browse files Browse the repository at this point in the history
  • Loading branch information
robzienert authored Aug 14, 2019
1 parent f59de43 commit f71feb2
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ class TitusClusterProvider implements ClusterProvider<TitusCluster>, ServerGroup
private final ObjectMapper objectMapper
private final Logger log = LoggerFactory.getLogger(getClass())

private final AwsLookupUtil awsLookupUtil
private final Provider<AwsLookupUtil> awsLookupUtil
private final Provider<CachingSchemaUtil> cachingSchemaUtil

@Autowired
TitusClusterProvider(TitusCloudProvider titusCloudProvider,
TitusCachingProvider titusCachingProvider,
Cache cacheView,
ObjectMapper objectMapper,
AwsLookupUtil awsLookupUtil,
Provider<AwsLookupUtil> awsLookupUtil,
Provider<CachingSchemaUtil> cachingSchemaUtil) {
this.titusCloudProvider = titusCloudProvider
this.cacheView = cacheView
Expand Down Expand Up @@ -191,11 +191,11 @@ class TitusClusterProvider implements ClusterProvider<TitusCluster>, ServerGroup
if (includeDetails) {
serverGroup.instances = translateInstances(resolveRelationshipData(serverGroupData, INSTANCES.ns), Collections.singletonList(serverGroupData)).values()
if (serverGroup.targetGroups) {
awsLookupUtil.lookupTargetGroupHealth(job, serverGroup.instances)
awsLookupUtil.get().lookupTargetGroupHealth(job, serverGroup.instances)
}
}
serverGroup.accountId = awsLookupUtil.awsAccountId(account, region)
serverGroup.awsAccount = awsLookupUtil.lookupAccount(account, region)?.awsAccount
serverGroup.accountId = awsLookupUtil.get().awsAccountId(account, region)
serverGroup.awsAccount = awsLookupUtil.get().lookupAccount(account, region)?.awsAccount
serverGroup
}

Expand Down Expand Up @@ -278,9 +278,9 @@ class TitusClusterProvider implements ClusterProvider<TitusCluster>, ServerGroup
serverGroup.instances = serverGroup.instances ?: []
serverGroup.targetGroups = serverGroupEntry.attributes.targetGroups
if (serverGroup.targetGroups) {
awsLookupUtil.lookupTargetGroupHealth(job, serverGroup.instances)
awsLookupUtil.get().lookupTargetGroupHealth(job, serverGroup.instances)
}
serverGroup.awsAccount = awsLookupUtil.lookupAccount(serverGroupEntry.attributes.account, serverGroupEntry.attributes.region)?.awsAccount
serverGroup.awsAccount = awsLookupUtil.get().lookupAccount(serverGroupEntry.attributes.account, serverGroupEntry.attributes.region)?.awsAccount
[(serverGroupEntry.id): serverGroup]
}
return serverGroups
Expand Down

0 comments on commit f71feb2

Please sign in to comment.