Skip to content

Commit

Permalink
Rescuing another type of timeout and limiting timeout to 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
oddlyfunctional committed Mar 11, 2015
1 parent 3200cdd commit f65e4a8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ gem 'twilio-ruby', '3.14.4'
gem 'foundation-rails', '5.5.1.0'
gem 'roboto', '0.2.0'
gem 'newrelic_rpm', '3.9.9.275'
gem 'link_thumbnailer', '2.5.0'
gem 'link_thumbnailer', '2.5.0', git: 'git://github.com/mrodrigues/link_thumbnailer.git'
gem 'acts-as-taggable-on', '3.4.3'
gem 'elasticsearch-model', '0.1.6'
gem 'elasticsearch-rails', '0.1.6'
Expand Down
31 changes: 18 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
GIT
remote: git://github.com/mrodrigues/link_thumbnailer.git
revision: cc7b8221ea803ae8eaf2f22d752dd1bae878803b
specs:
link_thumbnailer (2.5.0)
activesupport (>= 3.0)
fastimage (~> 1.6)
json (~> 1.8, >= 1.7.7)
net-http-persistent (~> 2.9)
nokogiri (~> 1.6)
rake (>= 0.9)
video_info (~> 2.4)

GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
Expand Down Expand Up @@ -143,7 +156,7 @@ GEM
railties (>= 3.0.0)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
fastimage (1.6.6)
fastimage (1.6.8)
addressable (~> 2.3, >= 2.3.5)
ffi (1.9.6)
fission (0.5.0)
Expand Down Expand Up @@ -278,14 +291,6 @@ GEM
addressable (~> 2.3)
letter_opener (1.3.0)
launchy (~> 2.2)
link_thumbnailer (2.5.0)
activesupport (>= 3.0)
fastimage (~> 1.6)
json (~> 1.8, >= 1.7.7)
net-http-persistent (~> 2.9)
nokogiri (~> 1.6)
rake (>= 0.9)
video_info (~> 2.4)
mail (2.6.3)
mime-types (>= 1.16, < 3)
memcachier (0.0.2)
Expand All @@ -294,7 +299,7 @@ GEM
mini_portile (0.6.2)
minitest (5.5.1)
mixpanel-ruby (1.7.0)
multi_json (1.10.1)
multi_json (1.11.0)
multi_xml (0.5.5)
multipart-post (2.0.0)
mustache (0.99.8)
Expand Down Expand Up @@ -543,7 +548,7 @@ GEM
temple (0.7.5)
terminal-table (1.4.5)
thor (0.19.1)
thread_safe (0.3.4)
thread_safe (0.3.5)
tilt (1.4.1)
timecop (0.7.1)
timers (4.0.1)
Expand All @@ -563,7 +568,7 @@ GEM
rack
raindrops (~> 0.7)
vcr (2.9.3)
video_info (2.4.0)
video_info (2.4.1)
addressable
htmlentities
multi_json
Expand Down Expand Up @@ -617,7 +622,7 @@ DEPENDENCIES
jbuilder (= 2.2.6)
jquery-rails (= 3.1.2)
letter_opener (= 1.3.0)
link_thumbnailer (= 2.5.0)
link_thumbnailer (= 2.5.0)!
memcachier (= 0.0.2)
mixpanel-ruby (= 1.7.0)
newrelic_rpm (= 3.9.9.275)
Expand Down
2 changes: 1 addition & 1 deletion app/services/link_thumbnailer_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def generate
LinkThumbnailer.generate(url)
rescue ArgumentError
Hashie::Mash.new(title: url, images: [src: url])
rescue SocketError, Net::HTTP::Persistent::Error
rescue SocketError, Net::HTTP::Persistent::Error, Net::OpenTimeout
Hashie::Mash.new(title: url, images: [])
end

Expand Down
3 changes: 2 additions & 1 deletion config/initializers/link_thumbnailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#
# See http://www.ruby-doc.org/stdlib-2.1.1/libdoc/net/http/rdoc/Net/HTTP.html#open_timeout
#
# config.http_timeout = 5
config.http_open_timeout = 5
config.http_read_timeout = 5

# List of blacklisted urls you want to skip when searching for images.
#
Expand Down

0 comments on commit f65e4a8

Please sign in to comment.