Skip to content

Commit

Permalink
Merge pull request #98 from Sage/change-list-topics
Browse files Browse the repository at this point in the history
Reduce calls to list-topics
  • Loading branch information
guille-sage authored Nov 8, 2023
2 parents 7e5c452 + 498a81c commit f96b0ec
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eventq.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_development_dependency 'activesupport', '~> 4'
spec.add_development_dependency 'bundler', '~> 1.11'
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'byebug', '~> 11.0'
spec.add_development_dependency 'pry-byebug', '~> 3.9'
spec.add_development_dependency 'rake', '~> 10.0'
Expand Down
7 changes: 1 addition & 6 deletions lib/eventq/eventq_aws/aws_eventq_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ def publish(topic:, event:, context: {}, region: nil)
end

def raise_event(event_type, event, context = {}, region = nil)
register_event(event_type, region)
topic_arn = register_event(event_type, region)

with_prepared_message(event_type, event, context) do |message|
topic_arn = topic_arn(event_type, region)
response = @client.sns(region).publish(
topic_arn: topic_arn,
message: message,
Expand Down Expand Up @@ -125,10 +124,6 @@ def serialized_message(queue_message)
serialization_provider.serialize(queue_message)
end

def topic_arn(event_type, region = nil)
@client.sns_helper(region).get_topic_arn(event_type, region)
end

def sqs_message_body_for(payload_message)
JSON.dump(EventQ::Amazon::QueueWorker::MESSAGE => payload_message)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/eventq/eventq_aws/sns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create_topic_arn(event_type, region = nil)
_event_type = EventQ.create_event_type(event_type)
topic_key = "#{region}:#{_event_type}"

arn = get_topic_arn(event_type, region)
arn = @@topic_arns[topic_key]
unless arn
response = sns.create_topic(name: aws_safe_name(_event_type))
arn = response.topic_arn
Expand Down
1 change: 0 additions & 1 deletion script/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ RUN set -ex \
&& gem install -N oj --version "3.6.10" \
&& gem install -N openssl --version "2.1.1" \
&& gem install -N byebug --version "10.0.2" \
&& gem install -N pry-byebug \
&& apk del .gem-builddeps

0 comments on commit f96b0ec

Please sign in to comment.