class RedisPage::SweeperWorker
Public Instance Methods
perform(url, country=nil)
click to toggle source
# File lib/redis_page/sweeper_worker.rb, line 9 def perform(url, country=nil) uri = URI(url) uri.port = RedisPage.sweeper[:port] uri.scheme = 'http' uri.query = uri.fragment = nil # 去掉 query string 等 auth = { username: RedisPage.sweeper[:username], password: RedisPage.sweeper[:password] } options = { basic_auth: auth } options[:cookies] = { country: country } if country Rails.logger.info "[page cache]sweeper fetching: #{uri}, country: #{country}" response = HTTParty.get(uri.to_s, options) Rails.logger.debug "[page cache]sweeper response: #{response.body}" end