Skip to content

Commit

Permalink
fix(events): simplify the cache key for cross-account targets (#3526)
Browse files Browse the repository at this point in the history
Since events cannot span regions,
there's no point keeping the region in the cache
(it will always be the same as the rule region).
  • Loading branch information
skinny85 authored and mergify[bot] committed Aug 7, 2019
1 parent ff20a43 commit db7dc2e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/@aws-cdk/aws-events/lib/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ export class Rule extends Resource implements IRule {
}

// the _actual_ target is just the event bus of the target's account
// make sure we only add it once per region
const key = `${targetAccount}-${targetRegion}`;
const exists = this.accountEventBusTargets[key];
// make sure we only add it once per account
const exists = this.accountEventBusTargets[targetAccount];
if (!exists) {
this.accountEventBusTargets[key] = true;
this.accountEventBusTargets[targetAccount] = true;
this.targets.push({
id,
arn: targetStack.formatArn({
Expand Down

0 comments on commit db7dc2e

Please sign in to comment.