maltese 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/Gemfile.lock +1 -1
- data/lib/maltese.rb +1 -1
- data/lib/maltese/sitemap.rb +10 -9
- data/lib/maltese/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8da994f0754cfeac0ebbf1621f0fdcfd3b733a39aa4e585194a0e740ccc3cfb
|
4
|
+
data.tar.gz: f30eaf6e92db60dcc2f09af4236e59a660b733596036b7e9cbe19682eba98cfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acae0001e505da772b326f6139abaa3c28df70f26dea5d68978a2e6c9c1969ae222c107814540ece4019b78c0c26be85c400896caec3e0995e5013057209abb5
|
7
|
+
data.tar.gz: 2f2a704e1e5c2caf4f394355f56d008dfc73dfa6484cff149a7a55d8c5ce0cc0fc601c5c57306b8dc24f8f58a0e0187774045275469a2c323cbc5a907147449d
|
data/Dockerfile
CHANGED
@@ -11,6 +11,6 @@ RUN apt-get update && apt-get upgrade -y -o Dpkg::Options::="--force-confold" &&
|
|
11
11
|
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
12
12
|
|
13
13
|
# Install maltese gem
|
14
|
-
RUN /sbin/setuser app gem install maltese -v 0.9.
|
14
|
+
RUN /sbin/setuser app gem install maltese -v 0.9.5
|
15
15
|
|
16
16
|
CMD maltese sitemap --sitemap_bucket $SITEMAP_BUCKET --rack_env $RACK_ENV --access_key $AWS_ACCESS_KEY_ID --secret_key $AWS_SECRET_ACCESS_KEY --region $AWS_REGION --slack_webhook_url $SLACK_WEBHOOK_URL
|
data/Gemfile.lock
CHANGED
data/lib/maltese.rb
CHANGED
data/lib/maltese/sitemap.rb
CHANGED
@@ -120,8 +120,11 @@ module Maltese
|
|
120
120
|
begin
|
121
121
|
response = nil
|
122
122
|
|
123
|
+
# speed up tests
|
124
|
+
base_interval = rack_env == "test" ? 0.1 : 10
|
125
|
+
|
123
126
|
# retry on temporal errors (status codes 408 and 502)
|
124
|
-
Retriable.retriable(base_interval:
|
127
|
+
Retriable.retriable(base_interval: base_interval, multiplier: 2) do
|
125
128
|
response = get_data(options[:url])
|
126
129
|
|
127
130
|
raise Timeout::Error, "A timeout error occured for URL #{options[:url]}." if response.status == 408
|
@@ -130,7 +133,7 @@ module Maltese
|
|
130
133
|
|
131
134
|
if response.status == 200
|
132
135
|
link_count = parse_data(response)
|
133
|
-
logger.info "#{link_count} DOIs parsed."
|
136
|
+
logger.info "#{(link_count + sitemap.sitemap_index.total_link_count).to_s(:delimited)} DOIs parsed."
|
134
137
|
options[:url] = response.body.dig("links", "next")
|
135
138
|
else
|
136
139
|
logger.error "An error occured for URL #{options[:url]}."
|
@@ -143,6 +146,8 @@ module Maltese
|
|
143
146
|
error_count += 1
|
144
147
|
fields = [
|
145
148
|
{ title: "Error", value: exception.message },
|
149
|
+
{ title: "Number of DOIs", value: sitemap.sitemap_index.total_link_count.to_s(:delimited), short: true },
|
150
|
+
{ title: "Number of Sitemaps", value: sitemap.sitemap_index.link_count.to_s(:delimited), short: true },
|
146
151
|
{ title: "Time Taken", value: "#{((Time.now - options[:start_time])/ 60.0).ceil} min", short: true }
|
147
152
|
]
|
148
153
|
send_notification_to_slack(nil, title: slack_title + ": Sitemaps Not Updated", level: "danger", fields: fields) unless rack_env == "test"
|
@@ -176,8 +181,9 @@ module Maltese
|
|
176
181
|
sitemap.sitemap_index.stats_summary(:time_taken => Time.now - options[:start_time])
|
177
182
|
|
178
183
|
fields = [
|
179
|
-
{ title: "URL", value:
|
180
|
-
{ title: "Number of DOIs", value:
|
184
|
+
{ title: "URL", value: sitemap.sitemap_index_url },
|
185
|
+
{ title: "Number of DOIs", value: sitemap.sitemap_index.total_link_count.to_s(:delimited), short: true },
|
186
|
+
{ title: "Number of Sitemaps", value: sitemap.sitemap_index.link_count.to_s(:delimited), short: true },
|
181
187
|
{ title: "Time Taken", value: "#{((Time.now - options[:start_time])/ 60.0).ceil} min", short: true }
|
182
188
|
]
|
183
189
|
send_notification_to_slack(nil, title: slack_title + ": Sitemaps Updated", level: "good", fields: fields) unless rack_env == "test"
|
@@ -204,10 +210,5 @@ module Maltese
|
|
204
210
|
logger.error exception.message
|
205
211
|
end
|
206
212
|
end
|
207
|
-
|
208
|
-
# from https://codereview.stackexchange.com/questions/28054/separate-numbers-with-commas
|
209
|
-
def format_number(number)
|
210
|
-
number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
|
211
|
-
end
|
212
213
|
end
|
213
214
|
end
|
data/lib/maltese/version.rb
CHANGED