Class: RedisPage::SweeperWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/redis_page/sweeper_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(url, country = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/redis_page/sweeper_worker.rb', line 5

def perform(url, country=nil)
  uri = URI(url)
  uri.port = RedisPage.sweeper[:port]

  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: #{url}, country: #{country}"
  response = HTTParty.get(uri, options)
  Rails.logger.debug "[page cache]sweeper response: #{response.body}"
end