Class: CacheHeaterJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/cache_heater_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(path) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/jobs/cache_heater_job.rb', line 6

def perform(path)
  url = "http://#{Rails.configuration.x.domain}#{path}"
  uri = URI(url)

  req = Net::HTTP::Get.new(uri)

  req['Cookie'] = "#{ENV['CACHE_REVALIDATE_SECRET_COOKIE']}=1"

  res = Net::HTTP.start(uri.hostname, uri.port) do |http|
    http.request(req)
  end

  "#{path}##{Time.now}"
end