examples/wikipedia-dns.rb in rubydns-0.9.1 vs examples/wikipedia-dns.rb in rubydns-0.9.2

- old
+ new

@@ -79,11 +79,12 @@ # Don't buffer output (for debug purposes) $stderr.sync = true stats = { requested: 0 } - fetcher = HttpFetcher.new + # Use a Celluloid supervisor so the system recovers if the actor dies + fetcher = HttpFetcher.supervise # Start the RubyDNS server RubyDNS.run_server do on(:start) do Process::Daemon::Privileges.change_user(RUN_AS) @@ -100,10 +101,10 @@ match(/(.+)\.wikipedia/, IN::TXT) do |transaction, match_data| title = match_data[1] stats[:requested] += 1 - response = fetcher.get(Wikipedia.summary_url(title)) + response = fetcher.actors.first.get(Wikipedia.summary_url(title)) summary = Wikipedia.extract_summary(response).force_encoding('ASCII-8BIT') transaction.respond!(*summary.chunked) end