Skip to content

Commit

Permalink
feat: use parallel processing for feed retrieval in health_check.rb (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gildesmarais authored Aug 9, 2024
1 parent b961897 commit 4a24997
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gem 'html2rss-configs', github: 'html2rss/html2rss-configs'
# gem 'html2rss-configs', path: '../html2rss-configs'

gem 'erubi'
gem 'parallel'
gem 'rack-cache'
gem 'rack-timeout'
gem 'rack-unreloader'
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ DEPENDENCIES
erubi
html2rss
html2rss-configs!
parallel
puma
rack-cache
rack-timeout
Expand Down
4 changes: 3 additions & 1 deletion app/health_check.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require 'parallel'

require_relative 'local_config'

module App
Expand Down Expand Up @@ -44,7 +46,7 @@ def run
# @return [Array<String>]
def errors
[].tap do |errors|
LocalConfig.feed_names.each do |feed_name|
Parallel.each(LocalConfig.feed_names, in_threads: 4) do |feed_name|
Html2rss.feed_from_yaml_config(LocalConfig::CONFIG_FILE, feed_name.to_s).to_s
rescue StandardError => e
errors << "[#{feed_name}] #{e.class}: #{e.message}"
Expand Down

0 comments on commit 4a24997

Please sign in to comment.