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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9b033d429a2c7fc65f0ace4cb25ed1b2ca1d4a9936fe37577c4df6ffe0b66ef
4
- data.tar.gz: 82de3dc19a541a178776666900f3699e49db594d9913708acd4c81b62fb72938
3
+ metadata.gz: b8da994f0754cfeac0ebbf1621f0fdcfd3b733a39aa4e585194a0e740ccc3cfb
4
+ data.tar.gz: f30eaf6e92db60dcc2f09af4236e59a660b733596036b7e9cbe19682eba98cfb
5
5
  SHA512:
6
- metadata.gz: 412ab3cd8434a4e8c58f87a46d6fe034e479d0885ab82aca782ef01451e96597a75c814242b6300cdb2fcd6a729fbca1598bad5a849cd3369e591352b9777eef
7
- data.tar.gz: 75ff7e0f61e8eaa2f5c455c0e05f0593bbac126222a378217b2569e5e70b9e39028672befec08710ab2f771e1efe831668409d68aae56f33ec0e2cfd1a001a9a
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.4
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maltese (0.9.4)
4
+ maltese (0.9.5)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  aws-sdk-s3 (~> 1.19)
7
7
  dotenv (~> 2.1, >= 2.1.1)
@@ -1,6 +1,6 @@
1
1
  require 'sitemap_generator'
2
- require 'maremma'
3
2
  require 'aws-sdk-s3'
3
+ require 'maremma'
4
4
  require 'mime/types'
5
5
  require 'active_support/all'
6
6
 
@@ -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: 10, multiplier: 2) do
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: "#{sitemap_url}sitemaps/sitemap.xml.gz" },
180
- { title: "Number of DOIs", value: format_number(sitemap.sitemap.link_count), short: true },
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
@@ -1,3 +1,3 @@
1
1
  module Maltese
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maltese
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner