eventq 2.5.2 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/eventq/eventq_aws/sns.rb +28 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 694ed72384dbe126f58a0813b002ba2ba597fd4cd0d2f477a3fd68d9f12396bc
|
4
|
+
data.tar.gz: 00eb675d57cd63827d55d59f9af6083d830226dcac7e2db3d281099cf30c8a06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e5368f9ac76beb781594a4d058bf4f71dfcf8b406d94af08aa3aee5edf67ff607edcd3eec54dceaa4c5d1f4ecff995500076353c2b4d4be6afaf6c03fb7c92e
|
7
|
+
data.tar.gz: ea183d9565147acaa569cec2c7e8f8ceeb43dc6a152085f28ea31d7e737ee7b2b335340388ace7d84221909934bb66da08cf4cab5286511a3c2ac18e9bcac0c9
|
@@ -32,6 +32,7 @@ module EventQ
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# Check if a TopicArn exists. This will check with AWS if necessary and cache the results if one is found
|
35
|
+
#
|
35
36
|
# @return TopicArn [String]
|
36
37
|
def get_topic_arn(event_type, region = nil)
|
37
38
|
_event_type = EventQ.create_event_type(event_type)
|
@@ -39,8 +40,7 @@ module EventQ
|
|
39
40
|
|
40
41
|
arn = @@topic_arns[topic_key]
|
41
42
|
unless arn
|
42
|
-
|
43
|
-
arn = response.topics.detect { |topic| topic.topic_arn.end_with?(":#{_event_type}") }&.topic_arn
|
43
|
+
arn = find_topic(_event_type)
|
44
44
|
|
45
45
|
@@topic_arns[topic_key] = arn if arn
|
46
46
|
end
|
@@ -62,6 +62,32 @@ module EventQ
|
|
62
62
|
def aws_safe_name(name)
|
63
63
|
return name[0..79].gsub(/[^a-zA-Z\d_\-]/,'')
|
64
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
# Finds the given topic, or returns nil if the topic could not be found
|
69
|
+
#
|
70
|
+
# @note Responses to list_topics can be paged, so to check *all* topics
|
71
|
+
# we'll need to request each page of topics using response.next_token for
|
72
|
+
# until the response no longer contains a next_token. Requests to
|
73
|
+
# list_topics are throttled to 30 TPS, so in the future we may need to
|
74
|
+
# handle this if it becomes a problem.
|
75
|
+
#
|
76
|
+
# @param topic_name [String] the name of the topic to find
|
77
|
+
# @return [String]
|
78
|
+
def find_topic(topic_name)
|
79
|
+
response = sns.list_topics
|
80
|
+
topics = response.topics
|
81
|
+
arn = topics.detect { |topic| topic.topic_arn.end_with?(":#{topic_name}") }&.topic_arn
|
82
|
+
|
83
|
+
while arn.nil? && response.next_token
|
84
|
+
response = sns.list_topics(next_token: response.next_token)
|
85
|
+
topics = response.topics
|
86
|
+
arn = topics.detect { |topic| topic.topic_arn.end_with?(":#{topic_name}") }&.topic_arn
|
87
|
+
end
|
88
|
+
|
89
|
+
arn
|
90
|
+
end
|
65
91
|
end
|
66
92
|
end
|
67
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SageOne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|