You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devdocs/lib/docs/subscribers/scraper_subscriber.rb

24 lines
603 B

11 years ago
module Docs
class ScraperSubscriber < Subscriber
self.namespace = 'scraper'
def queued(event)
event.payload[:urls].each do |url|
log "Queue: #{format_url url}"
end
end
alias_method :running, :queued
11 years ago
def ignore_response(event)
msg = "Ignore: #{format_url event.payload[:response].url}"
msg << " [#{event.payload[:response].code}]" if event.payload[:response].respond_to?(:code)
log(msg)
end
def process_response(event)
log "Process: #{format_url event.payload[:response].url} [#{event.duration.round}ms]"
end
end
end