Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce calls to list-topics #98

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Reduce calls to list-topics #98

merged 3 commits into from
Nov 8, 2023

Conversation

guille-sage
Copy link
Contributor

Since ListTopics only returns topics in batches of 100 and it gets rate limited, reduce paths that would call this API endpoint.

  • Get the topic ARN from elsewhere.
  • Call CreateTopic (which is idempotent) and use the returned ARN.

Since ListTopics only returns topics in batches of 100 and it gets rate
limited, reduce paths that would call this API endpoint.

- Get the topic ARN from elsewhere.
- Call CreateTopic (which is idempotent) and use the returned ARN.
Comment on lines +24 to 26
arn = @@topic_arns[topic_key]
unless arn
response = sns.create_topic(name: aws_safe_name(_event_type))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great spot, that should improve performance as lot :)

Creates a topic to which notifications can be published. Users can create at most 100,000 standard topics (at most 1,000 FIFO topics). For more information, see Creating an Amazon SNS topic in the Amazon SNS Developer Guide . This action is idempotent, so if the requester already owns a topic with the specified name, that topic's ARN is returned without creating a new topic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'm still worried someone was depending on weird behaviour, so I'll cut a major version just to be safe. I like to believe there was a reason for the previous approach... 😁

@guille-sage guille-sage merged commit f96b0ec into master Nov 8, 2023
1 check passed
@guille-sage guille-sage deleted the change-list-topics branch November 8, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants